当前位置: 技术问答>java相关
求Applet中paint,repaint,update的联系和区别。
来源: 互联网 发布时间:2015-05-13
本文导语: 谢谢! | public void repaint() Repaints this component. This method causes a call to this component's update method as soon as possible. public void update(Graphics g) The AWT calls the update method in response to a...
谢谢!
|
public void repaint()
Repaints this component.
This method causes a call to this component's update method as soon as possible.
public void update(Graphics g)
The AWT calls the update method in response to a call to repaintupdate or paint(not paint method).
The updatemethod of Component does the following:
Clears this component by filling it with the background color.
Sets the color of the graphics context to be the foreground color of this component.
Calls this component's paint method to completely redraw this component.
public void paint(Graphics g)
Paints this component.
repaint->update->paint
Repaints this component.
This method causes a call to this component's update method as soon as possible.
public void update(Graphics g)
The AWT calls the update method in response to a call to repaintupdate or paint(not paint method).
The updatemethod of Component does the following:
Clears this component by filling it with the background color.
Sets the color of the graphics context to be the foreground color of this component.
Calls this component's paint method to completely redraw this component.
public void paint(Graphics g)
Paints this component.
repaint->update->paint