简体   繁体   English

JFrame Repaint()单个组件

[英]JFrame Repaint() Individual Component

Is it possible to repaint only a specific component in a JFrame, rather than the entire thing? 是否可以仅重绘JFrame中的特定组件,而不是整个对象? If this is possible, how would you do this? 如果可能的话,您将如何做?

Yes, you can suggest the repainting of a single component by calling repaint(); 是的,您可以通过调用repaint();来建议对单个组件进行repaint(); on that component only. 仅在该组件上。 Per the Component API : 根据组件API

 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. 如果此组件是轻型组件,则此方法将导致尽快调用此组件的paint方法。 Otherwise, this method causes a call to this component's update method as soon as possible. 否则,此方法将导致尽快调用此组件的update方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM