• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Layouts inside panel

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic