Forums Register Login

JScrollPane JViewport question

+Pie Number of slices to send: Send
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.
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1316 times.
Similar Threads
Very Different Problem with JScrollPane
Control Visible Portion of JTextArea Displayed by JScrollPane
Using JScrollPane
JTextArea and scrolling
JScrollBar/JScrollPane
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:48:19.