File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply 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: 639
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)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Can you do JScrollPane content NORTH?
 
Similar Threads
Swing - valign
Does FlowLayout honor the preferred size of a JPanel?
JMenuBar not using default alignment?
component invisible
BorderLayout NORTH - can i make it bigger?