简体   繁体   English

如何完全清洁面板

[英]how can I clean my panel completely

Hi I have a panel on my frame which you can draw something on it.and also i have a "clean" button which clean my panel completely.but I don't know how can I do this work ? 嗨,我的面板上有一个面板,您可以在面板上画些东西。还有一个“清洁”按钮可以完全清洁面板。但是我不知道该怎么做? I use netbeans . 我用netbeans。 thanks 谢谢

Well, this really depends on the how you have got your panel to draw. 好吧,这实际上取决于您如何绘制面板。 Usually, someone would override the paint method of the panel and draw the screen based on Points or other geometric elements. 通常,有人会覆盖面板的绘制方法,并根据点或其他几何元素绘制屏幕。

To clean the panel, you would need to clear the points, and then force a redraw, using the panel's repaint() method. 要清洁面板,您需要清除这些点,然后使用面板的repaint()方法强制重绘。

This however really depends on how you have implemented the first part of your solution. 但是,这实际上取决于您如何实现解决方案的第一部分。 We really need more information to give a more precise answer. 我们确实需要更多信息才能给出更准确的答案。

使用clearRect方法在整个区域上绘制背景色

Custom Painting Approaches shows two common approaches to do custom painting. “定制绘画方法”显示了两种进行定制绘画的常用方法。 It also shows the common approaches to clear the painting. 它还显示了清除画作的常用方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM