• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java

 
Richard Mendoza
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a command button named CLOSE in my swing frame. I want to close a swing frame after clicking the command button named CLOSE. What shall I command in the actionPerformed() method?
 
Richard Teston
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ei, Pare mali ka ng topic na i post, doon ka dapat sa Swing/AWT/JFC, anyway answering your question use System.exit(0) under actionPerformed method.
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing/AWT/JFC forum,...
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.exit(0) will indeed close the frame, however, this will also close ALL your frames if you have any others running within the same application.
If you just need to close a frame without actually exiting the application, use myFrame.dispose() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic