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.
我在透明背景上绘图,但在每个循环中,我希望清除屏幕,而不是从以前的屏幕上绘图。
有没有办法在 Java 中擦除绘图屏幕?
您可能正在寻找Graphics#clearRect(). 不过,您可能需要将表面背景设置为透明颜色:
Graphics#clearRect()
graphics.setBackground(new Color(255, 255, 255, 0));