javax.swing
Class RepaintManager

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.RepaintManager

public class RepaintManager
extends Object sample code for java.lang.Object definition code for java.lang.Object

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.


Constructor Summary
RepaintManager sample code for javax.swing.RepaintManager.RepaintManager() definition code for javax.swing.RepaintManager.RepaintManager() ()
          Create a new RepaintManager instance.
 
Method Summary
 void addDirtyRegion sample code for javax.swing.RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int) definition code for javax.swing.RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  c, int x, int y, int w, int h)
          Add a component in the list of components that should be refreshed.
 void addInvalidComponent sample code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent) definition code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.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.
static RepaintManager sample code for javax.swing.RepaintManager definition code for javax.swing.RepaintManager currentManager sample code for javax.swing.RepaintManager.currentManager(java.awt.Component) definition code for javax.swing.RepaintManager.currentManager(java.awt.Component) (Component sample code for java.awt.Component definition code for java.awt.Component  c)
          Return the RepaintManager for the calling thread given a Component.
static RepaintManager sample code for javax.swing.RepaintManager definition code for javax.swing.RepaintManager currentManager sample code for javax.swing.RepaintManager.currentManager(javax.swing.JComponent) definition code for javax.swing.RepaintManager.currentManager(javax.swing.JComponent) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  c)
          Return the RepaintManager for the calling thread given a JComponent.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getDirtyRegion sample code for javax.swing.RepaintManager.getDirtyRegion(javax.swing.JComponent) definition code for javax.swing.RepaintManager.getDirtyRegion(javax.swing.JComponent) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  aComponent)
          Return the current dirty region for a component.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getDoubleBufferMaximumSize sample code for javax.swing.RepaintManager.getDoubleBufferMaximumSize() definition code for javax.swing.RepaintManager.getDoubleBufferMaximumSize() ()
          Returns the maximum double buffer size.
 Image sample code for java.awt.Image definition code for java.awt.Image getOffscreenBuffer sample code for javax.swing.RepaintManager.getOffscreenBuffer(java.awt.Component, int, int) definition code for javax.swing.RepaintManager.getOffscreenBuffer(java.awt.Component, int, int) (Component sample code for java.awt.Component definition code for java.awt.Component  c, int proposedWidth, int proposedHeight)
          Return the offscreen buffer that should be used as a double buffer with the component c.
 Image sample code for java.awt.Image definition code for java.awt.Image getVolatileOffscreenBuffer sample code for javax.swing.RepaintManager.getVolatileOffscreenBuffer(java.awt.Component, int, int) definition code for javax.swing.RepaintManager.getVolatileOffscreenBuffer(java.awt.Component, int, int) (Component sample code for java.awt.Component definition code for java.awt.Component  c, int proposedWidth, int proposedHeight)
          Return a volatile offscreen buffer that should be used as a double buffer with the specified component c.
 boolean isCompletelyDirty sample code for javax.swing.RepaintManager.isCompletelyDirty(javax.swing.JComponent) definition code for javax.swing.RepaintManager.isCompletelyDirty(javax.swing.JComponent) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  aComponent)
          Convenience method that returns true if aComponent will be completely painted during the next paintDirtyRegions().
 boolean isDoubleBufferingEnabled sample code for javax.swing.RepaintManager.isDoubleBufferingEnabled() definition code for javax.swing.RepaintManager.isDoubleBufferingEnabled() ()
          Returns true if this RepaintManager is double buffered.
 void markCompletelyClean sample code for javax.swing.RepaintManager.markCompletelyClean(javax.swing.JComponent) definition code for javax.swing.RepaintManager.markCompletelyClean(javax.swing.JComponent) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  aComponent)
          Mark a component completely clean.
 void markCompletelyDirty sample code for javax.swing.RepaintManager.markCompletelyDirty(javax.swing.JComponent) definition code for javax.swing.RepaintManager.markCompletelyDirty(javax.swing.JComponent) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  aComponent)
          Mark a component completely dirty.
 void paintDirtyRegions sample code for javax.swing.RepaintManager.paintDirtyRegions() definition code for javax.swing.RepaintManager.paintDirtyRegions() ()
          Paint all of the components that have been marked dirty.
 void removeInvalidComponent sample code for javax.swing.RepaintManager.removeInvalidComponent(javax.swing.JComponent) definition code for javax.swing.RepaintManager.removeInvalidComponent(javax.swing.JComponent) (JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  component)
          Remove a component from the list of invalid components.
static void setCurrentManager sample code for javax.swing.RepaintManager.setCurrentManager(javax.swing.RepaintManager) definition code for javax.swing.RepaintManager.setCurrentManager(javax.swing.RepaintManager) (RepaintManager sample code for javax.swing.RepaintManager definition code for javax.swing.RepaintManager  aRepaintManager)
          Set the RepaintManager that should be used for the calling thread.
 void setDoubleBufferingEnabled sample code for javax.swing.RepaintManager.setDoubleBufferingEnabled(boolean) definition code for javax.swing.RepaintManager.setDoubleBufferingEnabled(boolean) (boolean aFlag)
          Enables or disables double buffering in this RepaintManager.
 void setDoubleBufferMaximumSize sample code for javax.swing.RepaintManager.setDoubleBufferMaximumSize(java.awt.Dimension) definition code for javax.swing.RepaintManager.setDoubleBufferMaximumSize(java.awt.Dimension) (Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
          Set the maximum double buffer size.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.swing.RepaintManager.toString() definition code for javax.swing.RepaintManager.toString() ()
          Returns a string that displays and identifies this object's properties.
 void validateInvalidComponents sample code for javax.swing.RepaintManager.validateInvalidComponents() definition code for javax.swing.RepaintManager.validateInvalidComponents() ()
          Validate all of the components that have been marked invalid.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

RepaintManager sample code for javax.swing.RepaintManager() definition code for javax.swing.RepaintManager()

public RepaintManager()
Create a new RepaintManager instance. You rarely call this constructor. directly. To get the default RepaintManager, use RepaintManager.currentManager(JComponent) (normally "this").

Method Detail

currentManager sample code for javax.swing.RepaintManager.currentManager(java.awt.Component) definition code for javax.swing.RepaintManager.currentManager(java.awt.Component)

public static RepaintManager sample code for javax.swing.RepaintManager definition code for javax.swing.RepaintManager  currentManager(Component sample code for java.awt.Component definition code for java.awt.Component  c)
Return the RepaintManager for the calling thread given a Component.

Parameters:
c - a Component -- unused in the default implementation, but could be used by an overridden version to return a different RepaintManager depending on the Component
Returns:
the RepaintManager object

currentManager sample code for javax.swing.RepaintManager.currentManager(javax.swing.JComponent) definition code for javax.swing.RepaintManager.currentManager(javax.swing.JComponent)

public static RepaintManager sample code for javax.swing.RepaintManager definition code for javax.swing.RepaintManager  currentManager(JComponent sample code for javax.swing.JComponent definition code for javax.swing.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) sample code for javax.swing.RepaintManager.currentManager(java.awt.Component) definition code for javax.swing.RepaintManager.currentManager(java.awt.Component) .

Parameters:
c - a JComponent -- unused
Returns:
the RepaintManager object

setCurrentManager sample code for javax.swing.RepaintManager.setCurrentManager(javax.swing.RepaintManager) definition code for javax.swing.RepaintManager.setCurrentManager(javax.swing.RepaintManager)

public static void setCurrentManager(RepaintManager sample code for javax.swing.RepaintManager definition code for javax.swing.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.

Parameters:
aRepaintManager - the RepaintManager object to use

addInvalidComponent sample code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent) definition code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent)

public void addInvalidComponent(JComponent sample code for javax.swing.JComponent definition code for javax.swing.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.

See Also:
JComponent.isValidateRoot() sample code for javax.swing.JComponent.isValidateRoot() definition code for javax.swing.JComponent.isValidateRoot() , removeInvalidComponent(javax.swing.JComponent) sample code for javax.swing.RepaintManager.removeInvalidComponent(javax.swing.JComponent) definition code for javax.swing.RepaintManager.removeInvalidComponent(javax.swing.JComponent)

removeInvalidComponent sample code for javax.swing.RepaintManager.removeInvalidComponent(javax.swing.JComponent) definition code for javax.swing.RepaintManager.removeInvalidComponent(javax.swing.JComponent)

public void removeInvalidComponent(JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  component)
Remove a component from the list of invalid components.

See Also:
addInvalidComponent(javax.swing.JComponent) sample code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent) definition code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent)

addDirtyRegion sample code for javax.swing.RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int) definition code for javax.swing.RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)

public void addDirtyRegion(JComponent sample code for javax.swing.JComponent definition code for javax.swing.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.

See Also:
JComponent.repaint(long, int, int, int, int) sample code for javax.swing.JComponent.repaint(long, int, int, int, int) definition code for javax.swing.JComponent.repaint(long, int, int, int, int)

getDirtyRegion sample code for javax.swing.RepaintManager.getDirtyRegion(javax.swing.JComponent) definition code for javax.swing.RepaintManager.getDirtyRegion(javax.swing.JComponent)

public Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  getDirtyRegion(JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  aComponent)
Return the current dirty region for a component. Return an empty rectangle if the component is not dirty.


markCompletelyDirty sample code for javax.swing.RepaintManager.markCompletelyDirty(javax.swing.JComponent) definition code for javax.swing.RepaintManager.markCompletelyDirty(javax.swing.JComponent)

public void markCompletelyDirty(JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  aComponent)
Mark a component completely dirty. aComponent will be completely painted during the next paintDirtyRegions() call.


markCompletelyClean sample code for javax.swing.RepaintManager.markCompletelyClean(javax.swing.JComponent) definition code for javax.swing.RepaintManager.markCompletelyClean(javax.swing.JComponent)

public void markCompletelyClean(JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  aComponent)
Mark a component completely clean. aComponent will not get painted during the next paintDirtyRegions() call.


isCompletelyDirty sample code for javax.swing.RepaintManager.isCompletelyDirty(javax.swing.JComponent) definition code for javax.swing.RepaintManager.isCompletelyDirty(javax.swing.JComponent)

public boolean isCompletelyDirty(JComponent sample code for javax.swing.JComponent definition code for javax.swing.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.


validateInvalidComponents sample code for javax.swing.RepaintManager.validateInvalidComponents() definition code for javax.swing.RepaintManager.validateInvalidComponents()

public void validateInvalidComponents()
Validate all of the components that have been marked invalid.

See Also:
addInvalidComponent(javax.swing.JComponent) sample code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent) definition code for javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent)

paintDirtyRegions sample code for javax.swing.RepaintManager.paintDirtyRegions() definition code for javax.swing.RepaintManager.paintDirtyRegions()

public void paintDirtyRegions()
Paint all of the components that have been marked dirty.

See Also:
addDirtyRegion(javax.swing.JComponent, int, int, int, int) sample code for javax.swing.RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int) definition code for javax.swing.RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)

toString sample code for javax.swing.RepaintManager.toString() definition code for javax.swing.RepaintManager.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string that displays and identifies this object's properties.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a String representation of this object

getOffscreenBuffer sample code for javax.swing.RepaintManager.getOffscreenBuffer(java.awt.Component, int, int) definition code for javax.swing.RepaintManager.getOffscreenBuffer(java.awt.Component, int, int)

public Image sample code for java.awt.Image definition code for java.awt.Image  getOffscreenBuffer(Component sample code for java.awt.Component definition code for java.awt.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.


getVolatileOffscreenBuffer sample code for javax.swing.RepaintManager.getVolatileOffscreenBuffer(java.awt.Component, int, int) definition code for javax.swing.RepaintManager.getVolatileOffscreenBuffer(java.awt.Component, int, int)

public Image sample code for java.awt.Image definition code for java.awt.Image  getVolatileOffscreenBuffer(Component sample code for java.awt.Component definition code for java.awt.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.

Since:
1.4
See Also:
VolatileImage sample code for java.awt.image.VolatileImage definition code for java.awt.image.VolatileImage

setDoubleBufferMaximumSize sample code for javax.swing.RepaintManager.setDoubleBufferMaximumSize(java.awt.Dimension) definition code for javax.swing.RepaintManager.setDoubleBufferMaximumSize(java.awt.Dimension)

public void setDoubleBufferMaximumSize(Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
Set the maximum double buffer size.


getDoubleBufferMaximumSize sample code for javax.swing.RepaintManager.getDoubleBufferMaximumSize() definition code for javax.swing.RepaintManager.getDoubleBufferMaximumSize()

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getDoubleBufferMaximumSize()
Returns the maximum double buffer size.

Returns:
a Dimension object representing the maximum size

setDoubleBufferingEnabled sample code for javax.swing.RepaintManager.setDoubleBufferingEnabled(boolean) definition code for javax.swing.RepaintManager.setDoubleBufferingEnabled(boolean)

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.

Parameters:
aFlag - true to activate double buffering
See Also:
isDoubleBufferingEnabled() sample code for javax.swing.RepaintManager.isDoubleBufferingEnabled() definition code for javax.swing.RepaintManager.isDoubleBufferingEnabled()

isDoubleBufferingEnabled sample code for javax.swing.RepaintManager.isDoubleBufferingEnabled() definition code for javax.swing.RepaintManager.isDoubleBufferingEnabled()

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.

Returns:
true if this object is double buffered