aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JPanel Scrollbar Size problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPanel Scrollbar Size problems" Watch "JPanel Scrollbar Size problems" New topic
Author

JPanel Scrollbar Size problems

Bob Taboy
Greenhorn

Joined: Jul 22, 2013
Posts: 12
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



[Thumbnail for Picture1.jpg]

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2531
    
    8

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.

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPanel Scrollbar Size problems