java repaint中参数用法

liujun3512159 2010-01-15 05:50:34
在awt绘图开发中,经常要用到paint(),repaint(),repaint(x,y,width,height)
我知道在调用repaint()时候,会触发paint()方法
我想问下repaint()和repaint(x,y,width,height),这个不带参数和带参数有什么区别
我感觉,带参数,似乎也传不到paint()中吧

...全文
380 5 打赏 收藏 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengyoujie 2010-01-26
  • 打赏
  • 举报
回复
帮楼主顶了
whlcy 2010-01-26
  • 打赏
  • 举报
回复
看看sun源代码
randomer 2010-01-26
  • 打赏
  • 举报
回复
这种问题查API文档就好了,搞技术的自学能力很重要
lianghua19 2010-01-26
  • 打赏
  • 举报
回复
public void repaint()
Repaints this component.
If this component is a lightweight component, this method causes a call to this component's paint method as soon as possible. Otherwise, this method causes a call to this component's update method as soon as possible.

Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.



repaint
public void repaint(int x,
int y,
int width,
int height)
Repaints the specified rectangle of this component.
If this component is a lightweight component, this method causes a call to this component's paint method as soon as possible. Otherwise, this method causes a call to this component's update method as soon as possible.

Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.


Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
xlxyeyu 2010-01-15
  • 打赏
  • 举报
回复
查看API啊,都是重绘组件,区别是一个绘制全部区域,一个绘制指定的矩形区域~~

62,620

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧