• Post Reply Bookmark Topic Watch Topic
  • New Topic

Two frames in one application?

 
Hans vogn
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I was wondering if it's possible to have two JFrames in one application, or one JFrame and some other window (wich can use the paintComponent method)

I tryed the JInternalFrame, but i found out it only works inside the main frame, and I want two seperate frames.

I this possible, and if yes can someone tell me how it's done?

Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you do exactly the same as when you show a single frame.
i.e. create a new JFrame(), add component/s to it, give it a size/location and set it to visible.
one thing that should differ is the defaultCloseOperation.

generally, a JDialog is better suited (with frame1 as parent), instead of a 2nd JFame.
 
Hans vogn
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, it works just fine
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!