简体   繁体   中英

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 . 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.

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.

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.

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