Where server and port are JTextAreas holding the server and port, and configL is the label for the window. The label's set to "Save Successful.", but the file is blank after this runs. Can someone please tell me why?
EDIT 2: Above problem has been fixed. w.close(); Heh.
EDIT: configF is the JFrame holding all of this, and it should dissappear when I call configF.setVisible(false); but it doesn't. How should I go about making it dissappear?
10-20-2005, 08:52 PM
Norm
Could you post more code? setVisible(false) should work! Try adding a call to dispose().
10-20-2005, 09:36 PM
freeone3000
Code:
public JPanel createConfigPane()
{
final JPanel configPane = new JPanel(new GridBagLayout());
final JTextField server = new JTextField(serverIP);
final JTextField port = new JTextField(connPort);
JButton save = new JButton("Save");
JButton cancel = new JButton("Cancel");
save.setPreferredSize(new Dimension(70, 30));
cancel.setPreferredSize(new Dimension(90, 30));
JLabel portL = new JLabel("Port:");
JLabel serverL = new JLabel("Server address:");
final JLabel configL = new JLabel("Hiya!");
final GameGUI g = new GameGUI(new JFrame());
I hit "Cancel", and I see "..Ehm, bye?" up on top, where the JLabel is, after I click the "Cancel" button.
10-21-2005, 10:19 AM
Norm
What is your question now?
Yes the button's actionlistener puts that text into the configL component.
10-22-2005, 05:56 PM
freeone3000
Well, yes. But that's AFTER I dispose of the frame, and AFTER I set it to be invisible.
It should be set, but I shouldn't be able to see it.
Question would be: "How do I make JFrames go away?"
10-22-2005, 08:56 PM
Norm
Cant' explain it. If what you've shown is being execture, setVisible(false) should make close the frame.
I can only guess that the code isn't executing as you think it is.
Add some println()s to see where it is executing and when.
10-23-2005, 12:46 PM
freeone3000
Code:
configF.setVisible(false); System.out.println("It should be invisible.");
configL.setText("...Ehm, bye?");
configF.dispose(); System.out.println("It should be gone.");
It is printing out those two bolded lines, but the frame's still visible.
10-23-2005, 09:10 PM
Norm
Only looking at a small part of the program, its hard to say.
Does configF refer to the ONLY frame? Are there any others?
10-23-2005, 09:14 PM
freeone3000
There are a few other frames, else I would just call System.exit(0);. Generic "frame", which contains the main application frame. It's the only one "there" right now. The other frames are loginF, creditF, helpF, and charF, which are the login screen, credit screen, help screen, and characater creation screen, all uninitialized at this point.
createConfigPane() is called from a generic ActionListener set to a JButton, config, in the main "frame".