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.