Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to communicate between to containers  RSS feed

 
Jaypal Raj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can something be done as to click on the button a new frame or window can be opened....
pls some one get the solution???
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the button's actionPerformed()
new MyOtherWindow();

where MyOtherWindow is the name of the class that you want to open/show

depending entirely on what you are trying to do, perhaps the original
window, with a panel set as a CardLayout, might be a better option.
It would go something like this
CardLayout cl = new CardLayout(); //need to have access to this variable
JPanel clPanel = new JPanel(cl);

add the original window to clPanel (instead of to the contentPane/frame)
add the other window to clPanel

Click the button to show the other panel
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!