aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Little advice on JPanels in JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Little advice on JPanels in JFrame" Watch "Little advice on JPanels in JFrame" New topic
Author

Little advice on JPanels in JFrame

peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
hello javaRanchy's

i need a little pointer about JPanels and if that is even the best way to code...

I have a main GUI JFrame with:

menuBar -> JToolBar -> JPanel 1

what i want is create a seperate .java file for each new panel and then have update the main GUI when the selected panel is selected...

i.e

main.java
panel1.java
panel2.java
panel3.java

then in the main GUI

menuBar -> JToolBar -> JPanel 1
selected option in toolbar to show
menuBar -> JToolBar -> JPanel 2

hope that makes sence

i just want to have multiple JPanels ontop of each other then only set the one that is requested to be visable...

as a tabbed pane will have to many tabs and wont fit on the page...

any info will be a great help

many thanks
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

peter hammond wrote:i just want to have multiple JPanels ontop of each other then only set the one that is requested to be visable...


That's what CardLayout does.


luck, db
There are no new questions, but there may be new answers.
peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
cool thanks will give it a look wasnt sure what i needed to look at... ta
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Little advice on JPanels in JFrame