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.
You must use the validate();
method along with repaint();
.
frame.repaint();
frame.validate();
frame.setVisible(true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.