I've made a Menu bar and when i click on Help>>about a popup window jumps. i also put on the popup window a button and i'm wondering what's the command i should use to close the popup window in the button action listener but not abort the program. (i tried before to use (System.exit(0)) but it's abort the program.
-
Don't post a picture of your IDE, that doesn't help. In the future post a proper SSCCE that demonstrates the problem.camickr– camickr2015-12-01 21:35:11 +00:00Commented Dec 1, 2015 at 21:35
-
In the actionPerformed(ActionEvent e) method, you can use window.dispose(); or setVisible(false); window.dispose();byteherder– byteherder2015-12-01 22:11:15 +00:00Commented Dec 1, 2015 at 22:11
Add a comment
|
1 Answer
i'm wondering what's the command i should use to close the popup window
You would use:
window.dispose();
Or better yet just use a JOptionPane to display the "About" dialog. The JOptionPane will build the dialog and buttons for you.
Check out the section from the Swing tutorial on How to Make Dialogs for more information and examples.
