0

So I have a class which extends JPanel and on which I draw a BufferedImage (in its paintComponent method). However, the image doesn't show up until I resize the window. Any idea how to fix this? I've tried repaint without much success.

4

1 回答 1

3

You must use the validate(); method along with repaint();.

frame.repaint();
frame.validate();
frame.setVisible(true);
于 2013-01-10T22:37:02.297 回答