Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Layouts inside panel

 
Sandesh Jadhav
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on menu-based swing application. I am using CardLayout to display components on JFrame on clicking of the menu. I have used separate jpanel for each set of components to be diplayed inside JFrame. I would also need to layout the components dynamically on each panel on some event. For example, I will be displaying the List which is dynamically generated on clicking of the button inside the same panel. I might be having multiple dynamic components on same panel. So what approach should I take to layout the components inside the panel?

Thanks in advance


Cheers..
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I might be having multiple dynamic components on same panel. So what approach should I take to layout the components inside the panel?

that's almost like asking , "I'm getting a new car, what color should I order?"

so, it's up to you - what are you trying to do?

if you want the dynamic panels to display one underneath the other,
in a scrollPane a GridLayout panel or a BoxLayout Panel might do
 
Maneesh Godbole
Saloon Keeper
Posts: 11185
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandesh Jadhav wrote: So what approach should I take to layout the components inside the panel?


The UI design (as reflected by the layout) depends on you and your requirement.
In general you can dynamically add/remove from a container. Just make sure you call a revalidate and repaint to ensure your changes are reflected on the UI.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic