Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

badly stuck with GUI problem  RSS feed

 
Abhi Chat
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am makin the GUi which has the main frame and container inside the
public class...now i have an inner class which opens another
frame as a popup.... now when i try to close the popup then the entire
application closes.

heres the code for the popup class...

JPanel panel = new JPanel();


JFrame frame = new JFrame( "Graphs" );

frame.setSize(200,200);
frame.getContentPane().add( panel );
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);

//Make sure we have nice window decorations.
frame.setDefaultLookAndFeelDecorated(true);

//Display the window.
frame.pack();
frame.setVisible(true);


please advice
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using a different close operation for the frame, like DISPOSE_ON_CLOSE or HIDE_ON_CLOSE.

How does that work for you?
Cheers,
rachel
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!