Class CheckThreadViolationRepaintManager


  • public class CheckThreadViolationRepaintManager
    extends javax.swing.RepaintManager

    This class is used to detect Event Dispatch Thread rule violations
    See How to Use Threads for more info

    This is a modification of original idea of Scott Delap
    Initial version of ThreadCheckingRepaintManager can be found here
    Easily Find Swing Threading Mistakes

    Author:
    Scott Delap, Alexander Potochkin https://swinghelper.dev.java.net/
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean completeCheck  
      private java.lang.ref.WeakReference<javax.swing.JComponent> lastComponent  
      private static javax.swing.JButton test  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDirtyRegion​(javax.swing.JComponent component, int x, int y, int w, int h)  
      void addInvalidComponent​(javax.swing.JComponent component)  
      private void checkThreadViolations​(javax.swing.JComponent c)  
      (package private) static void imageUpdateTest()  
      boolean isCompleteCheck()  
      static void main​(java.lang.String[] args)  
      (package private) static void repaintTest()  
      void setCompleteCheck​(boolean completeCheck)  
      (package private) static void test()  
      protected void violationFound​(javax.swing.JComponent c, java.lang.StackTraceElement[] stackTrace)  
      • Methods inherited from class javax.swing.RepaintManager

        addDirtyRegion, addDirtyRegion, 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
    • Field Detail

      • completeCheck

        private boolean completeCheck
      • lastComponent

        private java.lang.ref.WeakReference<javax.swing.JComponent> lastComponent
      • test

        private static javax.swing.JButton test
    • Constructor Detail

      • CheckThreadViolationRepaintManager

        public CheckThreadViolationRepaintManager​(boolean completeCheck)
      • CheckThreadViolationRepaintManager

        public CheckThreadViolationRepaintManager()
    • Method Detail

      • isCompleteCheck

        public boolean isCompleteCheck()
      • setCompleteCheck

        public void setCompleteCheck​(boolean completeCheck)
      • addInvalidComponent

        public void addInvalidComponent​(javax.swing.JComponent component)
        Overrides:
        addInvalidComponent in class javax.swing.RepaintManager
      • addDirtyRegion

        public void addDirtyRegion​(javax.swing.JComponent component,
                                   int x,
                                   int y,
                                   int w,
                                   int h)
        Overrides:
        addDirtyRegion in class javax.swing.RepaintManager
      • checkThreadViolations

        private void checkThreadViolations​(javax.swing.JComponent c)
      • violationFound

        protected void violationFound​(javax.swing.JComponent c,
                                      java.lang.StackTraceElement[] stackTrace)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • test

        static void test()
      • imageUpdateTest

        static void imageUpdateTest()
      • repaintTest

        static void repaintTest()