Aru Gyani Aru Gyani - 26 days ago 17
Java Question

JFrame Repaint() Individual Component

Is it possible to repaint only a specific component in a JFrame, rather than the entire thing? If this is possible, how would you do this?

Answer

Yes, you can suggest the repainting of a single component by calling repaint(); on that component only. Per the Component 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. Otherwise, this method causes a call to this component's update method as soon as possible.

Comments