Requesting repainting || repaint() method || Java Applets || Java Tutorial for beginners

preview_player
Показать описание
Requesting Repainting

• An applet writes to its window only when its update() or paint( ) method is called by the AWT.
• Whenever your applet needs to update the information displayed in its window, it simply calls repaint( ).
• The repaint( ) method is defined by the AWT. It causes the AWT run-time system to execute a call to your applet’s update( ) method, which, in its default implementation, calls paint( ).

• Four forms of repaint()

void repaint( )
void repaint(int left, int top, int width, int height)
void repaint(long maxDelay)
void repaint(long maxDelay, int x, int y, int width, int height)

• The first version causes the entire window to be repainted.
• The second version specifies a region that will be repainted. Here, the coordinates of the upper-left corner of the region are specified by left and top, and the width and height of the region are passed in width and height.
• In 3rd and 4th forms, maxDelay specifies the maximum number of milliseconds that can elapse before update( ) is called.
Рекомендации по теме
visit shbcf.ru