public class RepaintManager extends Object
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.
| Constructor and Description |
|---|
RepaintManager()
Create a new RepaintManager instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDirtyRegion(Applet
Adds
applet to the list of
Components that need to be repainted.
|
void |
addDirtyRegion(JComponent
Add a component in the list of components that should be refreshed.
|
void |
addDirtyRegion(Window
Adds
window to the list of
Components that need to be repainted.
|
void |
addInvalidComponent(JComponent
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 |
currentManager(Component
Return the RepaintManager for the calling thread given a Component.
|
static RepaintManager |
currentManager(JComponent
Return the RepaintManager for the calling thread given a JComponent.
|
Rectangle |
getDirtyRegion(JComponent
Return the current dirty region for a component.
|
Dimension |
getDoubleBufferMaximumSize()
Returns the maximum double buffer size.
|
Image |
getOffscreenBuffer(Component
Return the offscreen buffer that should be used as a double buffer with the component
c.
|
Image |
getVolatileOffscreenBuffer(Component
Return a volatile offscreen buffer that should be used as a double buffer with the specified component
c.
|
boolean |
isCompletelyDirty(JComponent
Convenience method that returns true if
aComponent will be completely painted during the next paintDirtyRegions().
|
boolean |
isDoubleBufferingEnabled()
Returns true if this RepaintManager is double buffered.
|
void |
markCompletelyClean(JComponent
Mark a component completely clean.
|
void |
markCompletelyDirty(JComponent
Mark a component completely dirty.
|
void |
paintDirtyRegions()
Paint all of the components that have been marked dirty.
|
void |
removeInvalidComponent(JComponent
Remove a component from the list of invalid components.
|
static void |
setCurrentManager(RepaintManager
Set the RepaintManager that should be used for the calling thread.
|
void |
setDoubleBufferingEnabled(boolean aFlag)
Enables or disables double buffering in this RepaintManager.
|
void |
setDoubleBufferMaximumSize(Dimension
Set the maximum double buffer size.
|
String |
toString()
Returns a string that displays and identifies this object's properties.
|
void |
validateInvalidComponents()
Validate all of the components that have been marked invalid.
|
public RepaintManager()
public static RepaintManagercurrentManager(Component c)
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
public static RepaintManagercurrentManager(JComponent c)
Note: This method exists for backward binary compatibility with earlier versions of the Swing library. It simply returns the result returned by currentManager(Component).
c - a JComponent -- unused
public static void setCurrentManager(RepaintManageraRepaintManager)
aRepaintManager - the RepaintManager object to use
public void addInvalidComponent(JComponentinvalidComponent)
public void removeInvalidComponent(JComponentcomponent)
public void addDirtyRegion(JComponentc, int x, int y, int w, int h)
c - Component to repaint, null results in nothing happening.
x - X coordinate of the region to repaint
y - Y coordinate of the region to repaint
w - Width of the region to repaint
h - Height of the region to repaint
JComponent.repaint(long, int, int, int, int)
public void addDirtyRegion(Windowwindow, int x, int y, int w, int h)
window to the list of
Components that need to be repainted.
window - Window to repaint, null results in nothing happening.
x - X coordinate of the region to repaint
y - Y coordinate of the region to repaint
w - Width of the region to repaint
h - Height of the region to repaint
JFrame.repaint(long, int, int, int, int) ,
JWindow.repaint(long, int, int, int, int) ,
JDialog.repaint(long, int, int, int, int)
public void addDirtyRegion(Appletapplet, int x, int y, int w, int h)
applet to the list of
Components that need to be repainted.
applet - Applet to repaint, null results in nothing happening.
x - X coordinate of the region to repaint
y - Y coordinate of the region to repaint
w - Width of the region to repaint
h - Height of the region to repaint
JApplet.repaint(long, int, int, int, int)
public RectanglegetDirtyRegion(JComponent aComponent)
public void markCompletelyDirty(JComponentaComponent)
public void markCompletelyClean(JComponentaComponent)
public boolean isCompletelyDirty(JComponentaComponent)
public void validateInvalidComponents()
public void paintDirtyRegions()
public StringtoString()
public ImagegetOffscreenBuffer(Component c, int proposedWidth, int proposedHeight)
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 ImagegetVolatileOffscreenBuffer(Component c, int proposedWidth, int proposedHeight)
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.
VolatileImage
public void setDoubleBufferMaximumSize(Dimensiond)
public DimensiongetDoubleBufferMaximumSize()
public void setDoubleBufferingEnabled(boolean aFlag)
aFlag - true to activate double buffering
isDoubleBufferingEnabled()
public boolean isDoubleBufferingEnabled()
false to avoid unnecessary buffering in Swing. On platforms where native double buffering is not supported, the default value will be
true.