JFrame中JLabel中的ImageIcon只是重写任何重绘的尝试

时间:2021-08-01 11:20:44

This problem is with my Atari 2600 emulator, and this is frustrating me beyond belief.

这个问题与我的Atari 2600模拟器有关,这令我感到沮丧。

My code is in this pastebin: http://pastebin.com/2jS9NieD

我的代码在这个pastebin中:http://pastebin.com/2jS9NieD

Essentially, I simply cannot get the BufferedImage within the ImageIcon within the JLabel within the JFrame to refresh what is onscreen, and it is fricking ridiculous.

从本质上讲,我根本无法在JFrame中的JLabel内的ImageIcon中获取BufferedImage来刷新屏幕上的内容,而且它非常荒谬。

1 个解决方案

#1


-1  

Subclass JPanel and override the paint(Graphics) method to draw the BufferedImage onto the Graphics object. Add the panel to your frame, can simply call repaint() on the panel when you want to redraw it.

子类JPanel并覆盖paint(Graphics)方法以将BufferedImage绘制到Graphics对象上。将面板添加到框架中,当您想要重绘它时,可以简单地调用面板上的repaint()。

#1


-1  

Subclass JPanel and override the paint(Graphics) method to draw the BufferedImage onto the Graphics object. Add the panel to your frame, can simply call repaint() on the panel when you want to redraw it.

子类JPanel并覆盖paint(Graphics)方法以将BufferedImage绘制到Graphics对象上。将面板添加到框架中,当您想要重绘它时,可以简单地调用面板上的repaint()。