I am using a quite basic setup with a class extending JPanel which I add to a JFrame.
What happens is, that INITIALLY the window is painted properly, but once paintComponent is called, a strip of the old image (with the same height as the toolbar panel) is visible below the newly painted images - similar to playing card sticking out from a deck. But then, if i manually resize the window by for instance dragging the border, the background is grayed out as it should.
What is going on and how do I fix this?
posted 1 year ago
no doubt that you see some effects of the double buffering that Swing uses.
You can fix the unwanted effects by changing the 'paintComponent()' slightly: