jframe

How do I redraw things when my JFrame is restored (deiconified)?

孤街醉人 提交于 2019-12-12 04:56:27
问题 I have a very basic little JFrame with JToggleButtons and subclassed JPanels that know how to draw what I want them to draw. Selecting a button causes an oval to appear in the corresponding panel. Unselecting the buttons makes the drawings disappear. Unfortunately, minimizing (iconifying) and then restoring (deiconifying) causes any drawn shapes to disappear. So I need to trigger redrawings manually. The problem is that I can only get the redrawing done (that is, I only see it) if I show a

Swing: taking variables from two private jTextField?ActionPerformed classes

可紊 提交于 2019-12-12 04:46:30
问题 I'm in NetBeans 8.2 and I've constructed a nice jFrame GUI for a Binary-to-Decimal converter, I think I have the code in my two text fields correct but I can't figure out how to access the variables for my Button to perform operations on. I have 3 method operations called parseBinary, isBinary, and illegal that I want to use to perform operations on my two text fields. In NetBeans when you code a button the method is locked to private so that's my issue. I will post all my of code and

JFrame on website

强颜欢笑 提交于 2019-12-12 04:44:31
问题 I have an application which is composed of many JFrame objects (using Java and Netbeans). The 'main' frame has 4 buttons and each button opens another frame. Now my problem is that I want the whole application to be run on the web as a website. I was considering 3 possible scenarios (from my research): Use Java Web Start Convert JFrame to JApplet Create from scratch a Java web application I was hoping that maybe someone can give me some help, and guidelines of which option I should opt for.

How to close a JFrame in the middle of a program

左心房为你撑大大i 提交于 2019-12-12 04:23:55
问题 public class JFrameWithPanel extends JFrame implements ActionListener, ItemListener { int packageIndex; double price; double[] prices = {49.99, 39.99, 34.99, 99.99}; DecimalFormat money = new DecimalFormat("$0.00"); JLabel priceLabel = new JLabel("Total Price: "+price); JButton button = new JButton("Check Price"); JComboBox packageChoice = new JComboBox(); JPanel pane = new JPanel(); TextField text = new TextField(5); JButton accept = new JButton("Accept"); JButton decline = new JButton(

Communication between already existing classes

这一生的挚爱 提交于 2019-12-12 04:19:25
问题 I am sorry if this question seems pretty basic and there is already an answer for that, but unless I make it into a proper question, google won't find it. I have a main class that is a JFrame(there is and will be only one object, let's call it "main"), it creates and calls another JFrame class(let's call it window2), however, I still need this window2 to call methods from the already existing main class. Normally window2 would have something like Main mainMenu = new Main();. But this

Using Appletstub I created AppeltEnvironment and initilized applet but I keep getting Invalid Stream Header

拜拜、爱过 提交于 2019-12-12 03:46:43
问题 I have followed below link answer: https://stackoverflow.com/a/16095828/5436880 Scenario: I am replicating Website Applet behavior in my Java program, website is https://carelink.minimed.eu/patient/entry.jsp?bhcp=1. I have .Jar file downloaded for a applet. I added it to my Java Project. Using AppletStub I have passed relevant parameters and called classLoader. I am able to open applet window But I am getting error as Invalid Stram Header:0A0A0A0A error public class AppletSnipper{ public

Java JFrame setSize doesn`t work properly

这一生的挚爱 提交于 2019-12-12 03:36:29
问题 I am making a JFrame with the size of 500x500 pixels. I make a blue background and add a red square in the right-bottom corner from (490,490) to (500,500). Image: I don't see the red square on the screen. I switched the frame from not resizable to resizable and if I make the window larger the red dot is there. Is the frame size the same as application's window size? How can I make the application's window to be the exactly 500x500? 回答1: The frame is the size of the entire window, including

JFrame full screen focusing .

戏子无情 提交于 2019-12-12 03:33:29
问题 This is how i am setting a JFrame to full screen mode : //set full screen frame.dispose(); frame.setUndecorated(true); screenDevice.setFullScreenWindow(frame); frame.setVisible(true); //reset to window mode frame.dispose(); screenDevice.setFullScreenWindow(null); frame.setUndecorated(false); frame.setVisible(true); But, when i display any dialog, something like settings dialog, the dialog and full screen frame both lost their foucs and disappear on screen. Then i need to click in the taskbar

JFrame - adding checkboxes to the screen

做~自己de王妃 提交于 2019-12-12 03:23:57
问题 I want to have a JFrame that displays 5 different check boxes. Multiple checkboxes should be able to be selected. This code only reads the ExchangingCard1 line and ignores all other checkboxes. When you run it you will have only one checkbox with "A" as the character. JCheckBox ExchangingCard1 = new JCheckBox("A"); JCheckBox ExchangingCard2 = new JCheckBox("B"); JCheckBox ExchangingCard3 = new JCheckBox("C"); JCheckBox ExchangingCard4 = new JCheckBox("D"); JCheckBox ExchangingCard5 = new

How to close multiple JFrame and JDialog windows?

独自空忆成欢 提交于 2019-12-12 03:18:33
问题 I'm working on a program which has multiple JFrame and JDialog windows. I have a JFrame which contains a button, when I click on this button a JDialog window opens up. In this JDialog windows there is another button, which when is clicked it opens up a second JDialog window. In the second JDialog window I have a last button. What I want to do is to close both JDialog windows and JFrame window when this last button is clicked. This is how the opening order is: JFrame Frame1; JButton Button1;