• 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

JPanel Scrollbar Size problems

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello! I'm stuck with the GUI, I have a main panel with a border layout. in the south (or page_end) of the JPanel I have several components wich I would like to divide in 2 "zones" right and left. to make this I use gridbaglayout (just to remind this one is inside the borderlayout.south). The right zone is ok, but the left one has several components wich I would like to put inside a jscrollpane so they don't occupy lot of vertical space. the problem is that I just can't make that jscrollpane to keep the components in a smaller area, they just fit their necesities. to aling those components I use again GridBagLayout, wich goes inside the JScrollpane. I have already tried with set the maximumsize, setsize, but none of them work, any sugestion?
** I attached an image so you can see what I mean better

Picture1.jpg
[Thumbnail for Picture1.jpg]
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First are you sure it's not the left side that takes up the space since it has no scroll bars and such?

Using a GridBagLayout for me is a bit over complicate things. If I were you for the south panel (left and right):

Use BorderLayout. Right panel stuff goes in BorderLayout.RIGHT and left stuff goes in BorderLayout.LEFT.

Use a FlowLayout on left side and set its preferred size (dimension).

Again use a FlowLayout for the JScrollPane for the content on the right and set its preferred size.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic