| java.lang.Object javax.swing.RepaintManager
All known Subclasses: javax.swing.BufferStrategyPaintManager,
RepaintManager | public class RepaintManager (Code) | | 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.
version: 1.76 05/09/07 author: Arnaud Weber |
Inner Class :static class PaintManager | |
Constructor Summary | |
public | RepaintManager() Create a new RepaintManager instance. |
Method Summary | |
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 Component s that
need to be repainted. | public void | addDirtyRegion(Applet applet, int x, int y, int w, int h) Adds applet to the list of Component s 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. | void | collectDirtyComponents(Map<Component, Rectangle> dirtyComponents, Component dirtyComponent, java.util.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. | 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. | void | doubleBufferingChanged(JRootPane rootPane) Invoked when the doubleBuffered or useTrueDoubleBuffering
properties of a JRootPane change. | void | endPaint() Invoked after beginPaint has been invoked. | public Rectangle | getDirtyRegion(JComponent aComponent) Return the current dirty region for a component. | 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 . | 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 . | public boolean | isCompletelyDirty(JComponent aComponent) Convenience method that returns true if aComponent will be completely
painted during the next paintDirtyRegions(). | public boolean | isDoubleBufferingEnabled() Returns true if this RepaintManager is double buffered.
The default value for this property may vary from platform
to platform. | public void | markCompletelyClean(JComponent aComponent) Mark a component completely clean. | public void | markCompletelyDirty(JComponent aComponent) Mark a component completely dirty. | 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) | 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. | 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. | public void | setDoubleBufferMaximumSize(Dimension d) Set the maximum double buffer size. | public void | setDoubleBufferingEnabled(boolean aFlag) Enables or disables double buffering in this RepaintManager. | void | setPaintManager(PaintManager paintManager) Sets the PaintManager that is used to handle all
double buffered painting.
Parameters: paintManager - The PaintManager to use. | boolean | show(Container c, int x, int y, int w, int h) If possible this will show a previously rendered portion of
a Component. | 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. |
HANDLE_TOP_LEVEL_PAINT | final static boolean HANDLE_TOP_LEVEL_PAINT(Code) | | Whether or not the RepaintManager should handle paint requests
for top levels.
|
doubleBufferingEnabled | boolean doubleBufferingEnabled(Code) | | |
standardDoubleBuffer | DoubleBufferInfo standardDoubleBuffer(Code) | | |
volatileImageBufferEnabled | static boolean volatileImageBufferEnabled(Code) | | |
RepaintManager | public RepaintManager()(Code) | | Create a new RepaintManager instance. You rarely call this constructor.
directly. To get the default RepaintManager, use
RepaintManager.currentManager(JComponent) (normally "this").
|
addDirtyRegion | public void addDirtyRegion(JComponent c, int x, int y, int w, int h)(Code) | | 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.
Parameters: c - Component to repaint, null results in nothing happening. Parameters: x - X coordinate of the region to repaint Parameters: y - Y coordinate of the region to repaint Parameters: w - Width of the region to repaint Parameters: h - Height of the region to repaint See Also: JComponent.repaint |
addDirtyRegion | public void addDirtyRegion(Window window, int x, int y, int w, int h)(Code) | | Adds window to the list of Component s that
need to be repainted.
Parameters: window - Window to repaint, null results in nothing happening. Parameters: x - X coordinate of the region to repaint Parameters: y - Y coordinate of the region to repaint Parameters: w - Width of the region to repaint Parameters: h - Height of the region to repaint See Also: JFrame.repaint See Also: JWindow.repaint See Also: JDialog.repaint since: 1.6 |
addDirtyRegion | public void addDirtyRegion(Applet applet, int x, int y, int w, int h)(Code) | | Adds applet to the list of Component s that
need to be repainted.
Parameters: applet - Applet to repaint, null results in nothing happening. Parameters: x - X coordinate of the region to repaint Parameters: y - Y coordinate of the region to repaint Parameters: w - Width of the region to repaint Parameters: h - Height of the region to repaint See Also: JApplet.repaint since: 1.6 |
beginPaint | void beginPaint()(Code) | | 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();
}
|
copyArea | void copyArea(JComponent c, Graphics g, int x, int y, int w, int h, int deltaX, int deltaY, boolean clip)(Code) | | Does a copy area on the specified region.
Parameters: clip - Whether or not the copyArea needs to be clipped to theComponent's bounds. |
currentManager | public static RepaintManager currentManager(Component c)(Code) | | Return the RepaintManager for the calling thread given a Component.
Parameters: c - a Component -- unused in the default implementation, but couldbe used by an overridden version to return a different RepaintManagerdepending on the Component the RepaintManager object |
currentManager | static RepaintManager currentManager(AppContext appContext)(Code) | | Returns the RepaintManager for the specified AppContext. If
a RepaintManager has not been created for the specified
AppContext this will return null.
|
currentManager | public static RepaintManager currentManager(JComponent c)(Code) | | 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
RepaintManager.currentManager(Component) .
Parameters: c - a JComponent -- unused the RepaintManager object |
doubleBufferingChanged | void doubleBufferingChanged(JRootPane rootPane)(Code) | | Invoked when the doubleBuffered or useTrueDoubleBuffering
properties of a JRootPane change. This may come in on any thread.
|
endPaint | void endPaint()(Code) | | Invoked after beginPaint has been invoked.
|
getDirtyRegion | public Rectangle getDirtyRegion(JComponent aComponent)(Code) | | Return the current dirty region for a component.
Return an empty rectangle if the component is not
dirty.
|
getDoubleBufferMaximumSize | public Dimension getDoubleBufferMaximumSize()(Code) | | Returns the maximum double buffer size.
a Dimension object representing the maximum size |
getOffscreenBuffer | public Image getOffscreenBuffer(Component c, int proposedWidth, int proposedHeight)(Code) | | 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 | public Image getVolatileOffscreenBuffer(Component c, int proposedWidth, int proposedHeight)(Code) | | 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.
See Also: java.awt.image.VolatileImage since: 1.4 |
isCompletelyDirty | public boolean isCompletelyDirty(JComponent aComponent)(Code) | | 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.
|
isDoubleBufferingEnabled | public boolean isDoubleBufferingEnabled()(Code) | | 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 .
true if this object is double buffered |
markCompletelyClean | public void markCompletelyClean(JComponent aComponent)(Code) | | Mark a component completely clean. aComponent will not
get painted during the next paintDirtyRegions() call.
|
markCompletelyDirty | public void markCompletelyDirty(JComponent aComponent)(Code) | | Mark a component completely dirty. aComponent will be
completely painted during the next paintDirtyRegions() call.
|
nativeAddDirtyRegion | void nativeAddDirtyRegion(AppContext appContext, Container c, int x, int y, int w, int h)(Code) | | |
nativeQueueSurfaceDataRunnable | void nativeQueueSurfaceDataRunnable(AppContext appContext, Component c, Runnable r)(Code) | | |
paint | void paint(JComponent paintingComponent, JComponent bufferComponent, Graphics g, int x, int y, int w, int h)(Code) | | Paints a region of a component
Parameters: paintingComponent - Component to paint Parameters: bufferComponent - Component to obtain buffer for Parameters: g - Graphics to paint to Parameters: x - X-coordinate Parameters: y - Y-coordinate Parameters: w - Width Parameters: h - Height |
resetDoubleBuffer | void resetDoubleBuffer()(Code) | | 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.
|
scheduleHeavyWeightPaints | void scheduleHeavyWeightPaints()(Code) | | |
setCurrentManager | public static void setCurrentManager(RepaintManager aRepaintManager)(Code) | | 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 |
setDoubleBufferMaximumSize | public void setDoubleBufferMaximumSize(Dimension d)(Code) | | Set the maximum double buffer size. *
|
setDoubleBufferingEnabled | public void setDoubleBufferingEnabled(boolean aFlag)(Code) | | 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: RepaintManager.isDoubleBufferingEnabled |
setPaintManager | void setPaintManager(PaintManager paintManager)(Code) | | Sets the PaintManager that is used to handle all
double buffered painting.
Parameters: paintManager - The PaintManager to use. Passing in null indicatesthe fallback PaintManager should be used. |
show | boolean show(Container c, int x, int y, int w, int h)(Code) | | 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!
|
toString | public synchronized String toString()(Code) | | Returns a string that displays and identifies this
object's properties.
a String representation of this object |
useVolatileDoubleBuffer | boolean useVolatileDoubleBuffer()(Code) | | Returns true if we should use the Image returned
from getVolatileOffscreenBuffer to do double buffering.
|
|
|