Home > Back-end >  redraw
redraw

Time:09-23

In Java repaint the paintcomponent method is to call the method? The paintcomponent method is as long as the program runs has been called? If it is, why not write a repaint wouldn't be redrawn again?

CodePudding user response:

Paintcomponent not been called, is the called component needs to be redrawn, such as component was first shown to the screen, or window is the largest, minimize recovery, etc., the component is shown again when will automatically call redraw (general is also done through repaint method redraw, so want to know when to redraw can view the source code, to see what method calls the repaint method, such as call setvisible will show method, show method is called repaint, so as long as the timing of the call setvisible will redraw)
Otherwise in any time will not automatically call repaint method will not happen to redraw, this time will repaint themselves, such as painted on a panel to display, or change the background image to refresh background, etc., when the form has not been redrawn system itself, so is invisible to the change of the form, so this time the need to redraw,