• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple JFrames ?

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Everyone :

Im trying to implement a recursive Jframe based gui, i.e. one where sub components can launch their own instances of a program in a new JFrame.

I can open a new JPanel in a new frame, but on closing, it closes all JFrames as opposed only itself ?

Is there a way to avoid this ?

thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you have
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
change to
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please define "launch their own instances of a program". Do you mean that there would be separate processes running separate JVMs? This would be useful if you wanted one instance to survive when other instance crashes, but would likely be a heavy solution as far as memory and CPU usage was concerned.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!