Results 1 to 5 of 5
Thread: Netbeans GUI EXIT button?
- 04-01-2012, 08:30 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
Netbeans GUI EXIT button?
I want to implement Exit command for a window which open thru another window by NEW button.
The setups should be like this:
Window1(click NEW button) -> Window2(click NEW button) ->Window3(click EXIT button) ->Window2
btw, I am using this:
private void jButton1ActionPerformed(java.awt.event.A… evt) {
System.exit(0);
}
When I click EXIT in Window3, it closes all the 3 Windows
Thanks
- 04-01-2012, 09:40 PM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,540
- Rep Power
- 11
Re: Netbeans GUI EXIT button?
That's what the exit() command does: it's for shutting down the whole Java virtual machine. The API docs comment ominously "This method never returns normally".Java Code:System.exit(0);
If you want to close the window containing the exit button, just do that. setVisible() can be used to "close" windows.
You don't say what sort of component is involved (JFrame, JDialog etc) but the How to Make Frames page in Oracle's Tutorial will be useful. It contains a section on how to close them (including how to respond to a user closing a frame).
[Edit] I've just realised this is in the SWT/JFace forum... The point that you shouldn't use exit() remains, but you should look at the API docs of the component you use to represent a window to find a method that allows it to be hidden or deleted entirely.Last edited by pbrockway2; 04-01-2012 at 09:45 PM.
- 04-02-2012, 06:06 AM #3
Re: Netbeans GUI EXIT button?
... which isn't where it should be. The posted code
shows clearly that this is a Swing/Netbeans question, and that the code has been generated by the visual designer; also that it has been corrupted in the course of copy/pasting.Java Code:private void jButton1ActionPerformed(java.awt.event.A… evt) {
I'm moving the thread to AWT/Swing. To blackz, I suggest you dump the visual designer. It's an advanced tool, only worth learning if you plan to make a career of GUI design. Learn to hand-code your GUIs, with guidance from the tutorial and the API.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-02-2012, 06:14 AM #4
Re: Netbeans GUI EXIT button?
Cross posted
Netbeans GUI EXIT button? - Yahoo! Answers
Any more?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-04-2012, 04:28 AM #5
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
Similar Threads
-
Noughts And Crosses v2 help adding the buttons for play an exit button be
By Razorfc in forum New To JavaReplies: 9Last Post: 03-07-2012, 05:27 PM -
problem with the button "exit"
By mike28 in forum Java AppletsReplies: 3Last Post: 11-19-2011, 03:42 AM -
Minimize (not exit) the application to tray when the close button is clicked
By Nandish Reddy in forum EclipseReplies: 0Last Post: 04-28-2010, 01:39 PM -
Button Group in Netbeans.
By makpandian in forum NetBeansReplies: 2Last Post: 03-22-2010, 01:26 PM -
Adding EXIT button on MIDlet form
By Java Tip in forum Java TipReplies: 0Last Post: 11-22-2007, 10:13 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks