posted 15 years ago
Yea, I saw the problem after playing with it a bit more. I don't know the exact cause of the issue, but the problem is that when the scrollpane decides to show up the panel doesn't realize it needs to repaint itself. So you see the distortion in the panel with all the lines and double tree nodes, etc. The fix for this is to simply call repaint() at the end of your paintComponent method. I'm posting my code here because even though your code was just a sample, there were a few little things that I think you can skip over. For example, the way you were adding the scrollpane to the gradient then the gradient to the content pane, etc. Just more than needed to be done. Anyway, here's code that works the way you want.