Home » openjdk-7 » javax » swing » [javadoc | source]
javax.swing
public class: RepaintManager [javadoc | source]
java.lang.Object
   javax.swing.RepaintManager
This class manages repaint requests, allowing the number of repaints to be minimized, for example by collapsing multiple requests into a single repaint for members of a component tree.

As of 1.6 RepaintManager handles repaint requests for Swing's top level components (JApplet, JWindow, JFrame and JDialog). Any calls to repaint on one of these will call into the appropriate addDirtyRegion method.

Nested Class Summary:
static class  RepaintManager.PaintManager  PaintManager is used to handle all double buffered painting for Swing. Subclasses should call back into the JComponent method paintToOffscreen to handle the actual painting. 
Field Summary
static final  boolean HANDLE_TOP_LEVEL_PAINT    Whether or not the RepaintManager should handle paint requests for top levels. 
 boolean doubleBufferingEnabled     
 DoubleBufferInfo standardDoubleBuffer     
static  boolean volatileImageBufferEnabled     
 Rectangle tmp     
Constructor:
 public RepaintManager() 
Method from javax.swing.RepaintManager Summary:
addDirtyRegion,   addDirtyRegion,   addDirtyRegion,   addInvalidComponent,   beginPaint,   collectDirtyComponents,   copyArea,   currentManager,   currentManager,   currentManager,   doubleBufferingChanged,   endPaint,   getDirtyRegion,   getDoubleBufferMaximumSize,   getOffscreenBuffer,   getVolatileOffscreenBuffer,   isCompletelyDirty,   isDoubleBufferingEnabled,   isPainting,   markCompletelyClean,   markCompletelyDirty,   nativeAddDirtyRegion,   nativeQueueSurfaceDataRunnable,   paint,   paintDirtyRegions,   removeInvalidComponent,   resetDoubleBuffer,   resetVolatileDoubleBuffer,   scheduleHeavyWeightPaints,   setCurrentManager,   setDoubleBufferMaximumSize,   setDoubleBufferingEnabled,   setPaintManager,   show,   toString,   useVolatileDoubleBuffer,   validateInvalidComponents
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.RepaintManager Detail:
 public  void addDirtyRegion(JComponent c,
    int x,
    int y,
    int w,
    int h) 
    Add a component in the list of components that should be refreshed. If c already has a dirty region, the rectangle (x,y,w,h) will be unioned with the region that should be redrawn.
 public  void addDirtyRegion(Window window,
    int x,
    int y,
    int w,
    int h) 
    Adds window to the list of Components that need to be repainted.
 public  void addDirtyRegion(Applet applet,
    int x,
    int y,
    int w,
    int h) 
    Adds applet to the list of Components that need to be repainted.
 public synchronized  void addInvalidComponent(JComponent invalidComponent) 
    Mark the component as in need of layout and queue a runnable for the event dispatching thread that will validate the components first isValidateRoot() ancestor.
  void beginPaint() 
    Invoked prior to any paint/copyArea method calls. This will be followed by an invocation of endPaint. WARNING: Callers of this method need to wrap the call in a try/finally, otherwise if an exception is thrown during the course of painting the RepaintManager may be left in a state in which the screen is not updated, eg:
    repaintManager.beginPaint();
    try {
      repaintManager.paint(...);
    } finally {
      repaintManager.endPaint();
    }
    
  void collectDirtyComponents(Map<Component, Rectangle> dirtyComponents,
    Component dirtyComponent,
    List<Component> roots) 
  void copyArea(JComponent c,
    Graphics g,
    int x,
    int y,
    int w,
    int h,
    int deltaX,
    int deltaY,
    boolean clip) 
    Does a copy area on the specified region.
 public static RepaintManager currentManager(Component c) 
    Return the RepaintManager for the calling thread given a Component.
 static RepaintManager currentManager(AppContext appContext) 
    Returns the RepaintManager for the specified AppContext. If a RepaintManager has not been created for the specified AppContext this will return null.
 public static RepaintManager currentManager(JComponent c) 
    Return the RepaintManager for the calling thread given a JComponent.

    Note: This method exists for backward binary compatibility with earlier versions of the Swing library. It simply returns the result returned by #currentManager(Component) .

  void doubleBufferingChanged(JRootPane rootPane) 
    Invoked when the doubleBuffered or useTrueDoubleBuffering properties of a JRootPane change. This may come in on any thread.
  void endPaint() 
    Invoked after beginPaint has been invoked.
 public Rectangle getDirtyRegion(JComponent aComponent) 
    Return the current dirty region for a component. Return an empty rectangle if the component is not dirty.
 public Dimension getDoubleBufferMaximumSize() 
    Returns the maximum double buffer size.
 public Image getOffscreenBuffer(Component c,
    int proposedWidth,
    int proposedHeight) 
    Return the offscreen buffer that should be used as a double buffer with the component c. By default there is a double buffer per RepaintManager. The buffer might be smaller than (proposedWidth,proposedHeight) This happens when the maximum double buffer size as been set for the receiving repaint manager.
 public Image getVolatileOffscreenBuffer(Component c,
    int proposedWidth,
    int proposedHeight) 
    Return a volatile offscreen buffer that should be used as a double buffer with the specified component c. The image returned will be an instance of VolatileImage, or null if a VolatileImage object could not be instantiated. This buffer might be smaller than (proposedWidth,proposedHeight). This happens when the maximum double buffer size has been set for this repaint manager.
 public boolean isCompletelyDirty(JComponent aComponent) 
    Convenience method that returns true if aComponent will be completely painted during the next paintDirtyRegions(). If computing dirty regions is expensive for your component, use this method and avoid computing dirty region if it return true.
 public boolean isDoubleBufferingEnabled() 
    Returns true if this RepaintManager is double buffered. The default value for this property may vary from platform to platform. On platforms where native double buffering is supported in the AWT, the default value will be false to avoid unnecessary buffering in Swing. On platforms where native double buffering is not supported, the default value will be true.
 boolean isPainting() 
 public  void markCompletelyClean(JComponent aComponent) 
    Mark a component completely clean. aComponent will not get painted during the next paintDirtyRegions() call.
 public  void markCompletelyDirty(JComponent aComponent) 
    Mark a component completely dirty. aComponent will be completely painted during the next paintDirtyRegions() call.
  void nativeAddDirtyRegion(AppContext appContext,
    Container c,
    int x,
    int y,
    int w,
    int h) 
  void nativeQueueSurfaceDataRunnable(AppContext appContext,
    Component c,
    Runnable r) 
  void paint(JComponent paintingComponent,
    JComponent bufferComponent,
    Graphics g,
    int x,
    int y,
    int w,
    int h) 
    Paints a region of a component
 public  void paintDirtyRegions() 
    Paint all of the components that have been marked dirty.
 public synchronized  void removeInvalidComponent(JComponent component) 
    Remove a component from the list of invalid components.
  void resetDoubleBuffer() 
    This resets the double buffer. Actually, it marks the double buffer as invalid, the double buffer will then be recreated on the next invocation of getOffscreenBuffer.
  void resetVolatileDoubleBuffer(GraphicsConfiguration gc) 
    This resets the volatile double buffer.
  void scheduleHeavyWeightPaints() 
 public static  void setCurrentManager(RepaintManager aRepaintManager) 
    Set the RepaintManager that should be used for the calling thread. aRepaintManager will become the current RepaintManager for the calling thread's thread group.
 public  void setDoubleBufferMaximumSize(Dimension d) 
    Set the maximum double buffer size. *
 public  void setDoubleBufferingEnabled(boolean aFlag) 
    Enables or disables double buffering in this RepaintManager. CAUTION: The default value for this property is set for optimal paint performance on the given platform and it is not recommended that programs modify this property directly.
  void setPaintManager(PaintManager paintManager) 
    Sets the PaintManager that is used to handle all double buffered painting.
 boolean show(Container c,
    int x,
    int y,
    int w,
    int h) 
    If possible this will show a previously rendered portion of a Component. If successful, this will return true, otherwise false.

    WARNING: This method is invoked from the native toolkit thread, be very careful as to what methods this invokes!

 public synchronized String toString() 
    Returns a string that displays and identifies this object's properties.
 boolean useVolatileDoubleBuffer() 
    Returns true if we should use the Image returned from getVolatileOffscreenBuffer to do double buffering.
 public  void validateInvalidComponents() 
    Validate all of the components that have been marked invalid.