• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connecting Frames  RSS feed

 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you connect two frames in a program.
For Example, lets say I have a frame that has a button on it, when I click that button it would go to another frame that would have a label on it.
I am using AWT but Swing code would also be appreciated.
Thanks in advance!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, in your JButton's event, you just create a new JFrame...
JFrame f = new JFrame();
f.setVisible(true);
I would suggest going through the Java Swing Tutorial on JFrames and JButton events.
 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!