Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in JFrame and loading Dynamic JPanel

 
Anish Geo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Experts , I need some suggestions for the below scenario, my screen has two panels one is in left side & another is in right side of the screen.while opening the main screen I am having 3 buttons on the left side panel and none in the right side panel.If i clicked the 1st button 2 labels,2 text fields and 2 buttons should be displayed on the right side panel.I am having these components in a separate class file which extends a JPanel.Only in the run time i want to add this class file(as component) to the right side panel in the main screen.
Can any one guide how to make it possible?
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anish,
Welcome to the Ranch.

How are you dividing the left and right sides of your frame?Are you using JSplitPane?
Essentially what you need to do is add a listener to the buttons on the left panel. When the button is clicked, you need to set the appropriate panel to the right hand side.
Check out the JTabbedPane API on how to add/remove components.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic