closing an app

  • Thread starter Dirk Bruere at NeoPax
  • Start date
A

Arne Vajhøj

Got a simple app that's a frame and a jpanel with buttons on it.
Can't work out how to close it using one of the buttons rather than the
graphical interface provided.

Calling the dispose method of the JFrame object should do it.

Arne
 
R

Roedy Green

Got a simple app that's a frame and a jpanel with buttons on it.
Can't work out how to close it using one of the buttons rather than the
graphical interface provided.

Buttons are part of the GUI. Are you asking?

1. how do I close the frame gracefully and exit if my program decides
it would be a good idea?

2. what kind of code to I put in the event listener for the button to
close the frame and shut down.

See http://mindprod.com/jgloss/frame.html
http://mindprod.com/jgloss/jframe.html

The key is the Frame/JFrame.dispose method.

See also System.exit( int );
 
D

Dirk Bruere at NeoPax

Roedy said:
Buttons are part of the GUI. Are you asking?

1. how do I close the frame gracefully and exit if my program decides
it would be a good idea?

2. what kind of code to I put in the event listener for the button to
close the frame and shut down.

See http://mindprod.com/jgloss/frame.html
http://mindprod.com/jgloss/jframe.html

The key is the Frame/JFrame.dispose method.

See also System.exit( int );

Thanks guys - the word I did not know was "dispose"!

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.blogtalkradio.com/onetribe - Occult Talk Show
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Java app installer 13
Can an Applet beep? 4
Simple Netbeans problem 1
Delay 2
Java in Java 10
Official Java Classes 10
Invisible applet 29
JMF? 21

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top