Aru Gyani
Aru Gyani

Reputation: 17

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?

Upvotes: 0

Views: 270

Answers (1)

Hovercraft Full Of Eels
Hovercraft Full Of Eels

Reputation: 285430

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.

Upvotes: 1

Related Questions