所有类


javax.swing
类 RepaintManager

java.lang.Object
  继承者 javax.swing.RepaintManager

public class RepaintManager
   
   
   
   
extends Object

此类管理重绘请求,以最大限度地降低重绘次数。例如,通过将多个请求折叠到对组件树成员的单个重绘中。


构造方法摘要
RepaintManager()
          创建新的 RepaintManager 实例。
 
方法摘要
 voidaddDirtyRegion(JComponent c, int x, int y, int w, int h)
          在应刷新的组件列表中添加组件。
 voidaddInvalidComponent(JComponent invalidComponent)
          按照布局需要标记组件,并将事件指派线程的 runnable 排入队列,该线程将验证组件的第一个 isValidateRoot() 祖先。
static RepaintManagercurrentManager(Component c)
          在给定 Component 的情况下,返回调用线程的 RepaintManager。
static RepaintManagercurrentManager(JComponent c)
          在给定 JComponent 的情况下,返回调用线程的 RepaintManager。
 RectanglegetDirtyRegion(JComponent aComponent)
          返回组件的当前脏区。
 DimensiongetDoubleBufferMaximumSize()
          返回最大双缓冲区大小。
 ImagegetOffscreenBuffer(Component c, int proposedWidth, int proposedHeight)
          返回屏幕外缓冲区,它应用作带有组件 c 的双缓冲区。
 ImagegetVolatileOffscreenBuffer(Component c, int proposedWidth, int proposedHeight)
          返回可变屏幕外缓冲区,它应用作带有指定组件 c 的双缓冲区。
 booleanisCompletelyDirty(JComponent aComponent)
          在下一个 paintDirtyRegions() 中全部绘制 aComponent 时返回 true 的便捷方法。
 booleanisDoubleBufferingEnabled()
          如果此 RepaintManager 被双缓冲,则返回 true。
 voidmarkCompletelyClean(JComponent aComponent)
          标记完全干净的组件。
 voidmarkCompletelyDirty(JComponent aComponent)
          标记完全弄脏的组件。
 voidpaintDirtyRegions()
          绘制被标记为脏的所有组件。
 voidremoveInvalidComponent(JComponent component)
          从无效组件的列表移除组件。
static voidsetCurrentManager(RepaintManager aRepaintManager)
          设置用于调用线程的 RepaintManager。
 voidsetDoubleBufferingEnabled(boolean aFlag)
          在此 RepaintManager 中,启用或禁用双缓冲。
 voidsetDoubleBufferMaximumSize(Dimension d)
          设置最大双缓冲区大小。
 StringtoString()
          返回一个显示并标记此对象属性的字符串。
 voidvalidateInvalidComponents()
          验证被标记为无效的所有组件。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

RepaintManager

public RepaintManager()
创建新的 RepaintManager 实例。很少直接调用此构造方法。要获取默认 RepaintManager,请使用 RepaintManager.currentManager(JComponent)(通常为 "this")。

方法详细信息

currentManager

public static RepaintManager currentManager(Component c)
在给定 Component 的情况下,返回调用线程的 RepaintManager。

参数:
c - 一个 Component - 在默认实现中未使用,但是重写版本可以使用它,以根据 Component 返回不同的 RepaintManager
返回:
RepaintManager 对象

currentManager

public static RepaintManager currentManager(JComponent c)
在给定 JComponent 的情况下,返回调用线程的 RepaintManager。

注:此方法用于与 Swing 库早期版本的向后二进制兼容性。它只返回 currentManager(Component) 返回的结果。

参数:
c - 未使用的 JComponent
返回:
RepaintManager 对象

setCurrentManager

public static void setCurrentManager(RepaintManager aRepaintManager)
设置用于调用线程的 RepaintManager。aRepaintManager 将成为调用线程的线程组的当前 RepaintManager。

参数:
aRepaintManager - 要使用的 RepaintManager 对象

addInvalidComponent

public void addInvalidComponent(JComponent invalidComponent)
按照布局需要标记组件,并将事件指派线程的 runnable 排入队列,该线程将验证组件的第一个 isValidateRoot() 祖先。

另请参见:
JComponent.isValidateRoot(), removeInvalidComponent(javax.swing.JComponent)

removeInvalidComponent

public void removeInvalidComponent(JComponent component)
从无效组件的列表移除组件。

另请参见:
addInvalidComponent(javax.swing.JComponent)

addDirtyRegion

public void addDirtyRegion(JComponent c,
                           int x,
                           int y,
                           int w,
                           int h)
在应刷新的组件列表中添加组件。如果 c 已有脏区 (dirty region),则矩形 (x,y,w,h) 将与应重绘的区域合并。

另请参见:
JComponent.repaint(long, int, int, int, int)

getDirtyRegion

public Rectangle getDirtyRegion(JComponent aComponent)
返回组件的当前脏区。如果组件不脏,则返回空矩形。