views:

32

answers:

2

I have a JEditorPane contained in a JScrollPane. The vertical scrollbar policy is set to Always. But, the scrollbar doesn't always function. The lane or the channel of the scrollbar is present but there is not elevator sometimes. Here is the weird thing. It, depends on what was previously in the editor pane. If the previous text put in the editor pane did not require scrolling, then I transition to a block of the text that does require scrolling, the elevator does not show up. However, if the previous block of text did require scrolling, the elevator does appear.

Any ideas about what might be going on?

Thanks,

Elliott

+1  A: 

You probably need to call revalidate on your JScrollPane after you modify its content.

Christian
A: 

What worked for me in this instance was removing the size constraints on the editorpane and scrollpane. And putting them on a container which holds the scrollpane/editorpane instead. I tried revalidating but that didn't work. I think if there is a conflict between the preferred size of the editorpane and scrollpane, java gets lost and does not know how to reconcile the differences.

Elliott