java中的repaint方法
为什么要重绘,老师好像讲的是paint是自动调用的不是吗?不是每操作一次就会调用一次吗,repaint是什么还是说之后调用paint不会直接在显示出来,所以才repain...
为什么要重绘,老师好像讲的是paint是自动调用的不是吗?不是每操作一次就会调用一次吗,repaint是什么
还是说之后调用paint不会直接在显示出来,所以才repaint 展开
还是说之后调用paint不会直接在显示出来,所以才repaint 展开
2个回答
展开全部
球球了,看个源码吧,里面都有些
第一行就是, repaints this component
/**
* Repaints this component.
* <p>
* If this component is a lightweight component, this method
* causes a call to this component's {@code paint}
* method as soon as possible. Otherwise, this method causes
* a call to this component's {@code update} method as soon
* as possible.
* <p>
* <b>Note</b>: For more information on the paint mechanisms utilitized
* by AWT and Swing, including information on how to write the most
* efficient painting code, see
* <a href="http://www.oracle.com/technetwork/java/painting-140037.html">Painting in AWT and Swing</a>.
*
* @see #update(Graphics)
* @since 1.0
*/
第一行就是, repaints this component
/**
* Repaints this component.
* <p>
* If this component is a lightweight component, this method
* causes a call to this component's {@code paint}
* method as soon as possible. Otherwise, this method causes
* a call to this component's {@code update} method as soon
* as possible.
* <p>
* <b>Note</b>: For more information on the paint mechanisms utilitized
* by AWT and Swing, including information on how to write the most
* efficient painting code, see
* <a href="http://www.oracle.com/technetwork/java/painting-140037.html">Painting in AWT and Swing</a>.
*
* @see #update(Graphics)
* @since 1.0
*/
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询