开发者

Render Newly Visible Portion Upon Scrolling on JScrollPane

开发者_C百科I have a large JPanel embedded in a JScrollPane. When I move the scrollbar, I notice that the visible portion does not render itself and I get glitches. Whereas when I resize the frame, I can see the new visible portions rendered. So I need to know which methods are fired upon frame resize to repaint the view. What listeners/methods should I use?


So I need to know which methods are fired upon frame resize

You don't need to know that. All you need to do is change the value of the scrollbar or the position of viewport and the component should repaint itself properly. If it is not painting properly, then you have a problem with something else. Maybe

  1. incorrect custom painting code
  2. the code is not invoked on the EDT

If those suggestsion doen't help then you need to post a proper SSCCE that demonstrates the problem because we can't keep guessing what your code is doing.


Did you revalidate the panel? It might be that something is not right in the code of yours. I have been using lots of scrolls and never had an issue as you describe. Maybe a code sample showing the problem would be nice.

Good luck, Boro

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜