spin.over
Class CheckingRepaintManager

java.lang.Object
  extended by javax.swing.RepaintManager
      extended by spin.over.CheckingRepaintManager

public class CheckingRepaintManager
extends javax.swing.RepaintManager

A repaintManager that checks bad access - i.e. access from non EDT - to Swing components. Install with:

 RepaintManager.setCurrentManager(new CheckingRepaintManager());
 
Based on an idea by Scott Delap (http://www.clientjava.com).

See Also:
RepaintManager

Constructor Summary
CheckingRepaintManager()
           
 
Method Summary
 void addDirtyRegion(javax.swing.JComponent component, int x, int y, int w, int h)
          Overriden to check EDT rule.
 void addInvalidComponent(javax.swing.JComponent component)
          Overriden to check EDT rule.
protected  void checkEDTRule(java.awt.Component component)
          Check EDT rule on access to the given component.
protected  void indicate(EDTRuleViolation violation)
          Indicate a violation of the EDT rule.
protected  boolean isLiableToEDTRule(java.lang.StackTraceElement element)
          Is the given stackTraceElement liable to the EDT rule.
protected  boolean violatesEDTRule(java.awt.Component component)
          Does acces to the given component violate the EDT rule.
 
Methods inherited from class javax.swing.RepaintManager
currentManager, currentManager, getDirtyRegion, getDoubleBufferMaximumSize, getOffscreenBuffer, getVolatileOffscreenBuffer, isCompletelyDirty, isDoubleBufferingEnabled, markCompletelyClean, markCompletelyDirty, paintDirtyRegions, removeInvalidComponent, setCurrentManager, setDoubleBufferingEnabled, setDoubleBufferMaximumSize, toString, validateInvalidComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CheckingRepaintManager

public CheckingRepaintManager()
Method Detail

addInvalidComponent

public void addInvalidComponent(javax.swing.JComponent component)
Overriden to check EDT rule.

Overrides:
addInvalidComponent in class javax.swing.RepaintManager

addDirtyRegion

public void addDirtyRegion(javax.swing.JComponent component,
                           int x,
                           int y,
                           int w,
                           int h)
Overriden to check EDT rule.

Overrides:
addDirtyRegion in class javax.swing.RepaintManager

checkEDTRule

protected void checkEDTRule(java.awt.Component component)
Check EDT rule on access to the given component.

Parameters:
component - component to be repainted

violatesEDTRule

protected boolean violatesEDTRule(java.awt.Component component)
Does acces to the given component violate the EDT rule.

Parameters:
component - accessed component
Returns:
true if EDT rule is violated

isLiableToEDTRule

protected boolean isLiableToEDTRule(java.lang.StackTraceElement element)
                             throws java.lang.Exception
Is the given stackTraceElement liable to the EDT rule.

Parameters:
element - element
Returns:
true if the className of the given element denotes a subclass of java.awt.Component
Throws:
java.lang.Exception - on any problem

indicate

protected void indicate(EDTRuleViolation violation)
                 throws EDTRuleViolation
Indicate a violation of the EDT rule. This default implementation throws the given exception, subclasses may want to log the exception instead.

Parameters:
violation - violation of EDT rule
Throws:
EDTRuleViolation


Copyright © 2007. All Rights Reserved.