aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JPanel repainting weirdly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPanel repainting weirdly" Watch "JPanel repainting weirdly" New topic
Author

JPanel repainting weirdly

Thomas Moul
Greenhorn

Joined: Sep 17, 2004
Posts: 4
In my program I have a JPanel that contains a picture of a waveform in a JFrame. That part is fine. But I also made it so that if you click on it and drag it will scroll through the waveform, which does scroll, but doesn't repaint correctly. It causes the about half the picture to appear below the actual picture. It's not a huge problem, but it's really annoying, and I haven't found a way to fix it yet.

Currently I have a MouseInputListener in the JPanel checking to see if it is dragged, and then resetting what data was part of the waveform, and finally calling repaint(). Maybe repaint isn't the best? Thanks for any help.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Code adapted from reply 3 in this thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPanel repainting weirdly
 
Similar Threads
Do certain events make calls to repaint redundant?
Help on Applet idea
jpanel help
Jpanels and Jscrollpanels
watching an applet to draw waveform