Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用双缓冲区在屏幕上绘制随机方块,但是当我调整窗框大小时会自行清理。我该如何阻止这一切?
在被告知时进行绘画。那将是paint(Graphics)a 的方法JFrame。
paint(Graphics)
JFrame
当然,最好是JPanel在框架中放置一个。然后,要覆盖的方法将变为paintComponent(Graphics).
JPanel
paintComponent(Graphics)