This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Terminate an application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Terminate an application" Watch "Terminate an application" New topic
Author

Terminate an application

Dirk Trompetter
Greenhorn

Joined: Aug 21, 2001
Posts: 13
How can I terminate an application by selecting a menu entry, for example "Quit"?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
System.exit() is what you need. You will need to put this in the actionEvent of clicking that menu item.
Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Mindy Wu
Ranch Hand

Joined: Jan 12, 2001
Posts: 121
Should that be System.exit(0)?
Dirk Trompetter
Greenhorn

Joined: Aug 21, 2001
Posts: 13
thanks, it works.
Originally posted by Mindy Wu:
Should that be System.exit(0)?

 
Have you checked out Aspose?
 
subject: Terminate an application
 
It's not a secret anymore!