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

Print this page

        

*** 61,70 **** --- 61,71 ---- 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.
*** 4800,4810 **** * @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); } /** * Adds the specified region to the dirty region list if the component --- 4801,4812 ---- * @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(SunToolkit.targetToAppContext(this)) ! .addDirtyRegion(this, x, y, width, height); } /** * Adds the specified region to the dirty region list if the component
*** 4854,4864 **** // 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()) { invalidate(); RepaintManager.currentManager(this).addInvalidComponent(this); } else { // To avoid a flood of Runnables when constructing GUIs off --- 4856,4866 ---- // 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 (SunToolkit.isDispatchThreadForAppContext(this)) { invalidate(); RepaintManager.currentManager(this).addInvalidComponent(this); } else { // To avoid a flood of Runnables when constructing GUIs off
*** 4868,4886 **** if (getFlag(REVALIDATE_RUNNABLE_SCHEDULED)) { return; } setFlag(REVALIDATE_RUNNABLE_SCHEDULED, true); } ! Runnable callRevalidate = new Runnable() { ! public void run() { synchronized(JComponent.this) { setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false); } revalidate(); ! } ! }; ! SwingUtilities.invokeLater(callRevalidate); } } /** * If this method returns true, <code>revalidate</code> calls by --- 4870,4885 ---- if (getFlag(REVALIDATE_RUNNABLE_SCHEDULED)) { return; } setFlag(REVALIDATE_RUNNABLE_SCHEDULED, true); } ! SunToolkit.executeOnEventHandlerThread(this, () -> { synchronized(JComponent.this) { setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false); } revalidate(); ! }); } } /** * If this method returns true, <code>revalidate</code> calls by