src/share/classes/javax/swing/JComponent.java

Print this page

        

@@ -61,10 +61,11 @@
 import javax.swing.event.*;
 import javax.swing.plaf.*;
 import static javax.swing.ClientPropertyKey.*;
 import javax.accessibility.*;
 
+import sun.awt.SunToolkit;
 import sun.swing.SwingUtilities2;
 import sun.swing.UIClientPropertyKey;
 
 /**
  * The base class for all Swing components except top-level containers.

@@ -4799,11 +4800,12 @@
      * @see #isPaintingOrigin()
      * @see java.awt.Component#isShowing
      * @see RepaintManager#addDirtyRegion
      */
     public void repaint(long tm, int x, int y, int width, int height) {
-        RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width, height);
+        RepaintManager.currentManager(SunToolkit.targetToAppContext(this))
+                      .addDirtyRegion(this, x, y, width, height);
     }
 
 
     /**
      * Adds the specified region to the dirty region list if the component

@@ -4854,11 +4856,11 @@
             // new Component). Also, if we do add a check to isValid
             // here it can potentially be called before the constructor
             // which was causing some people grief.
             return;
         }
-        if (SwingUtilities.isEventDispatchThread()) {
+        if (SunToolkit.isDispatchThreadForAppContext(this)) {
             invalidate();
             RepaintManager.currentManager(this).addInvalidComponent(this);
         }
         else {
             // To avoid a flood of Runnables when constructing GUIs off

@@ -4876,11 +4878,11 @@
                         setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false);
                     }
                     revalidate();
                 }
             };
-            SwingUtilities.invokeLater(callRevalidate);
+            SunToolkit.executeOnEventHandlerThread(this, callRevalidate);
         }
     }
 
     /**
      * If this method returns true, <code>revalidate</code> calls by