• 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

JList Sizing

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created my screen layout which contains a title panel, t=2 JLists with labels and buttons. At the moment I have the 2 JLists and their labels in 2 BoxLayout Panels which I then place into another BoxLayout Panel to stack them vertically. However my problem is that the JLists are stretching to fill the entire center panel. is there anyway i can position this panel in the center with space on either side?
Also is it possible to create more of a dropdown list rather than a JList?
Thanks
 
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could use borders with insets:
Border border1 = BorderFactory.createEmptyBorder (5,5,5,5);
Border border2 = BorderFactory.createBevelBorder (BevelBorder.LOWERED);
Border border = BorderFactory.createCompoundBorder (border2, border1);
and then use
setBorder on the Box panel.

Check out JComboBox for a drop down list.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic