aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Can you do JScrollPane content NORTH? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can you do JScrollPane content NORTH?" Watch "Can you do JScrollPane content NORTH?" New topic
Author

Can you do JScrollPane content NORTH?

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi guys,
I have a scollpanel which contains dynamic content, but I can not find a way to fix the content to the top of the panel, the content alwats starts in the middle.

The panel is set to "vertical-scrollable" so as the content grows the display is fine as it seems to be pushed up the panel and the scrollbar allows the user to view the full content, but if there is only a few lines to the content then it appears slap-bang in the middle! I have looked but the ScollPanelayout manager does not seem to have any 'NORTH' type of flag.

Any ideas?
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
It sounds like your scroll pane is not being laid out properly. You should look at the layout manager for the container into which you've placed the scroll pane. Some layout manager make it easy to direct that you want a component to take up available space (vertically, horizontally or both). GridBagLayout, for example does this.

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
I'll have a looking into the layout manager.... to be continued (no doubt)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can you do JScrollPane content NORTH?