File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes  Doubt in JFrame and loading Dynamic JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark " Doubt in JFrame and loading Dynamic JPanel" Watch " Doubt in JFrame and loading Dynamic JPanel" New topic
Author

Doubt in JFrame and loading Dynamic JPanel

Anish Geo
Greenhorn

Joined: Mar 09, 2009
Posts: 1
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

Joined: Jul 26, 2007
Posts: 10535
    
    9

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.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in JFrame and loading Dynamic JPanel