Reputation: 17
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
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