wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JScrollPane JViewport question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollPane JViewport question" Watch "JScrollPane JViewport question" New topic
Author

JScrollPane JViewport question

SzeKit Hsu
Greenhorn

Joined: Oct 05, 2004
Posts: 1
When I add a JTextArea into a JScrollPane, I get a portion of the JTextArea showing through the JViewport associated with the scrollpane, with 2 JScrollBar s which ranges are corresponding to the width and height of the text area. Moving the vertical scroll bar to the top always takes me to view at the top of the text area, and moving the horizontal scroll bar to the left always takes me to the view at the left of the text area.

I was wondering if it is possible to only allow the scroll bars to scroll to a different minimum such that even if the user scroll to the top or left, a portion of the textarea still won't be visible to them.

The reason I ask for this behavior is that I'm trying to implement a text area that has a "freeze pane"-type functionality that is found in MS Excel. I need a way to hide a portion of the data (namely bands on the top and the left which data is already showing in the frozen panes)

Another way I thought that this might work is to translating the view of the Viewport on the text area. I have been drilling into the java source code on JViewport and JScrollPane for a while but to no avail.

I am not sure which approach is feasible, or if there's yet another better way to do this. Help is greatly appreciated. Take care.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JScrollPane JViewport question