This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes RepaintManager V. UI Delegate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "RepaintManager V. UI Delegate" Watch "RepaintManager V. UI Delegate" New topic

RepaintManager V. UI Delegate

Landon Blake
Ranch Hand

Joined: Dec 04, 2003
Posts: 121
I'm a little confused about the role of the repaint manager and UI delegate in painting Swing Components. It seems like they might do some of the same tasks. Which one handles a call that results in the painting or repainting of a Swing component? Does the UI dlegate recieve the call initially and pass the look and feel information to the repaint manager, or is it the other way around. I looked at the API's and read the article "Painting in AWT and Swing" but I'm still a little confused.
Thanks for any help,
[ March 05, 2004: Message edited by: Landon Blake ]
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

RepaintManager handles the overall mechanics of repainting... how often it should be done, keeping track of "dirty" areas, etc. UI Delegates specify the look and feel of the specific component.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120

RepaintManager exists for two purposes: to provide efficient revalidation and repainting. It intercepts all repaint() and revalidate() requests. This class also handles all double-buffering in Swing and maintains a single Image used for this purpose. This Image�s maximum size is, by default, the size of the screen. However, we can set its size manually using RepaintManager�s setDoubleBufferMaximumSize() method.

This is from the excellent book Swing by Robinson and Vorobiev. Read more here

SCJP2. Please Indent your code using UBB Code
I agree. Here's the link:
subject: RepaintManager V. UI Delegate
Similar Threads
custom repaint on JButton on mouserollover
getGraphics returnning null pointer exception
Repaint method not working from button call
Java2D Dinosaur? paint vs. repaint
Repainting Swing Components