|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.RepaintManager
public class RepaintManager
The repaint manager holds a set of dirty regions, invalid components, and a double buffer surface. The dirty regions and invalid components are used to coalesce multiple revalidate() and repaint() calls in the component tree into larger groups to be refreshed "all at once"; the double buffer surface is used by root components to paint themselves.
See this document for more details.
document for more details.
Constructor Summary | |
---|---|
RepaintManager()
Create a new RepaintManager object. |
Method Summary | |
---|---|
void |
addDirtyRegion(JComponent component,
int x,
int y,
int w,
int h)
Add a region to the set of dirty regions for a specified component. |
void |
addInvalidComponent(JComponent component)
Add a component to the invalidComponents vector. |
static RepaintManager |
currentManager(Component component)
Returns the RepaintManager for the current thread's
thread group. |
static RepaintManager |
currentManager(JComponent component)
Returns the RepaintManager for the current thread's
thread group. |
Rectangle |
getDirtyRegion(JComponent component)
Get the dirty region associated with a component, or null
if the component has no dirty region. |
Dimension |
getDoubleBufferMaximumSize()
Get the value of the doubleBufferMaximumSize property. |
Image |
getOffscreenBuffer(Component component,
int proposedWidth,
int proposedHeight)
Get an offscreen buffer for painting a component's image. |
Image |
getVolatileOffscreenBuffer(Component comp,
int proposedWidth,
int proposedHeight)
Creates and returns a volatile offscreen buffer for the specified component that can be used as a double buffer. |
boolean |
isCompletelyDirty(JComponent component)
Return true if the specified component is completely
contained within its dirty region, otherwise false |
boolean |
isDoubleBufferingEnabled()
Get the value of the doubleBufferingEnabled property. |
void |
markCompletelyClean(JComponent component)
Remove all dirty regions for a specified component |
void |
markCompletelyDirty(JComponent component)
Mark a component as dirty over its entire bounds. |
void |
paintDirtyRegions()
Repaint all regions of all components which have been marked dirty in the dirtyComponents table. |
void |
removeInvalidComponent(JComponent component)
Remove a component from the invalidComponents vector. |
static void |
setCurrentManager(RepaintManager manager)
Sets the repaint manager for the calling thread's thread group. |
void |
setDoubleBufferingEnabled(boolean buffer)
Set the value of the doubleBufferingEnabled property. |
void |
setDoubleBufferMaximumSize(Dimension size)
Set the value of the doubleBufferMaximumSize property. |
String |
toString()
Convert this Object to a human-readable String. |
void |
validateInvalidComponents()
Validate all components which have been marked invalid in the invalidComponents vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RepaintManager()
Method Detail |
---|
public static RepaintManager currentManager(Component component)
RepaintManager
for the current thread's
thread group. The default implementation ignores the
component
parameter and returns the same repaint manager
for all components.
component
- a component to look up the manager of
setCurrentManager(javax.swing.RepaintManager)
public static RepaintManager currentManager(JComponent component)
RepaintManager
for the current thread's
thread group. The default implementation ignores the
component
parameter and returns the same repaint manager
for all components.
This method is only here for backwards compatibility with older versions
of Swing and simply forwards to currentManager(Component)
.
component
- a component to look up the manager of
setCurrentManager(javax.swing.RepaintManager)
public static void setCurrentManager(RepaintManager manager)
manager
- the repaint manager to set for the current thread's thread
groupcurrentManager(Component)
public void addInvalidComponent(JComponent component)
invalidComponents
vector. If the
repaintWorker
class is not active, insert it in the system
event queue.
component
- The component to addremoveInvalidComponent(javax.swing.JComponent)
public void removeInvalidComponent(JComponent component)
invalidComponents
vector.
component
- The component to removeaddInvalidComponent(javax.swing.JComponent)
public void addDirtyRegion(JComponent component, int x, int y, int w, int h)
repaintWorker
class
is not active, insert it in the system event queue.
component
- The component to add a dirty region forx
- The left x coordinate of the new dirty regiony
- The top y coordinate of the new dirty regionw
- The width of the new dirty regionh
- The height of the new dirty regionaddDirtyRegion(javax.swing.JComponent, int, int, int, int)
,
getDirtyRegion(javax.swing.JComponent)
,
isCompletelyDirty(javax.swing.JComponent)
,
markCompletelyClean(javax.swing.JComponent)
,
markCompletelyDirty(javax.swing.JComponent)
public Rectangle getDirtyRegion(JComponent component)
null
if the component has no dirty region.
component
- The component to get the dirty region of
dirtyComponents
,
addDirtyRegion(javax.swing.JComponent, int, int, int, int)
,
isCompletelyDirty(javax.swing.JComponent)
,
markCompletelyClean(javax.swing.JComponent)
,
markCompletelyDirty(javax.swing.JComponent)
public void markCompletelyDirty(JComponent component)
component
- The component to mark as dirtydirtyComponents
,
addDirtyRegion(javax.swing.JComponent, int, int, int, int)
,
getDirtyRegion(javax.swing.JComponent)
,
isCompletelyDirty(javax.swing.JComponent)
,
markCompletelyClean(javax.swing.JComponent)
public void markCompletelyClean(JComponent component)
component
- The component to mark as cleandirtyComponents
,
addDirtyRegion(javax.swing.JComponent, int, int, int, int)
,
getDirtyRegion(javax.swing.JComponent)
,
isCompletelyDirty(javax.swing.JComponent)
,
markCompletelyDirty(javax.swing.JComponent)
public boolean isCompletelyDirty(JComponent component)
true
if the specified component is completely
contained within its dirty region, otherwise false
component
- The component to check for complete dirtyness
dirtyComponents
,
addDirtyRegion(javax.swing.JComponent, int, int, int, int)
,
getDirtyRegion(javax.swing.JComponent)
,
isCompletelyDirty(javax.swing.JComponent)
,
markCompletelyClean(javax.swing.JComponent)
public void validateInvalidComponents()
invalidComponents
vector.
public void paintDirtyRegions()
dirtyComponents
table.
public Image getOffscreenBuffer(Component component, int proposedWidth, int proposedHeight)
doubleBufferMaximumSize
property.
component
- The component to return an offscreen buffer forproposedWidth
- The proposed width of the offscreen bufferproposedHeight
- The proposed height of the offscreen buffer
public Image getVolatileOffscreenBuffer(Component comp, int proposedWidth, int proposedHeight)
VolatileImage
. Its size will be (proposedWidth,
proposedHeight)
except when the maximum double buffer size
has been set in this RepaintManager.
comp
- the Component for which to create a volatile bufferproposedWidth
- the proposed width of the bufferproposedHeight
- the proposed height of the bufferVolatileImage
public Dimension getDoubleBufferMaximumSize()
doubleBufferMaximumSize
property.
setDoubleBufferMaximumSize(java.awt.Dimension)
public void setDoubleBufferMaximumSize(Dimension size)
doubleBufferMaximumSize
property.
size
- The new value of the propertygetDoubleBufferMaximumSize()
public void setDoubleBufferingEnabled(boolean buffer)
doubleBufferingEnabled
property.
buffer
- The new value of the propertyisDoubleBufferingEnabled()
public boolean isDoubleBufferingEnabled()
doubleBufferingEnabled
property.
setDoubleBufferingEnabled(boolean)
public String toString()
Object
System.out.println()
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a RuntimeException
.
This method will be called when performing string
concatenation with this object. If the result is
null
, string concatenation will instead
use "null"
.
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode())
.
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |