• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanel Scrollbar Size problems

 
Bob Taboy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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]
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic