Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Problem with JScrollPane while Scrolling

  Asked By: Kristopher    Date: Oct 07    Category: Java    Views: 1473

I have a problem. I have a JPanel which has some JAVA2D graphics on it.
I placed this panel into a JScrollPane.
If I scroll the JScrollpane, the Jpanel is not repainted automatically. The
Java2D graphics on the JPanel gets smeared.

Any ideas how I can overcome this problem? I thougt that, maybe there is a
listener, which listens to this scrolling action. But I couldn't find anything.



1 Answer Found

Answer #1    Answered By: Vidhya Iyer     Answered On: Oct 07

You can possibly adapt the MouseMotionListener, to track the
scrolling action. Everytime a mouse event occurs, you can check
whether JScrollPane's scrollbars' value has changed. If some
scrollbar value changes then repaint the JPanel.

Didn't find what you were looking for? Find more on Problem with JScrollPane while Scrolling Or get search suggestion and latest updates.