开发者

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 w开发者_C百科ork ? 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.


Use the clearRect method to draw the background color over the whole area


Custom Painting Approaches shows two common approaches to do custom painting. It also shows the common approaches to clear the painting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜