Forums Register Login

JScrollPane with multiple JEditorPanes

+Pie Number of slices to send: Send
Hi guys,

I have a scroll pane with a number of editor panes. The trouble is, the scroll pane always scrolls to the last editor pane - despite my best efforts. So, the net result is that the scrollpane always ends up and the bottom, not at the top.

If I replace the editor panes with JTextFields of similar size, the scrolling works fine (i.e. it scrolls to the top, not the bottom). Though, if I use a JTextArea, the problem is the same as before.

Any suggestions? Basically, I want the scroll pane to scroll to the top when loaded, not be scrolled to the bottom and the editor pane doesn't seem to want this to happen!

Any help is much appreciated.

Cheers,

Steve
+Pie Number of slices to send: Send
You may want to post your code to show people how you have things set up.
+Pie Number of slices to send: Send
Hi John,

I'd post some code, but I've just realised that if I strip it back to the situation I describe, it works fine.

I've gone through the code and I can't see anything that calls setCaretPosition, etc, so I'm completely at a loss.

Any suggestions how to debug things like this? I use eclipse.

Any help is much appreciated.

Cheers,

Steve
+Pie Number of slices to send: Send
Sorry, let me add to that - except where I'm telling it to set the scrollpane to the top.

pneHost.getViewport().setViewPosition(new Point(0, 0));
pneHost.scrollRectToVisible(new Rectangle(0, 0, 0, 0));

Again, any help most appreciated on how to debug this.

Cheers,

Steve
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1027 times.
Similar Threads
Scrollable JList
Is there any way to bring the a Vertical Scroll Bars of the Scroll Pane at the Bottom by default???
Auto Scroll List/Scroll Pane
pane
JScrollBar/JScrollPane
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 04:08:46.