src/java.desktop/share/classes/javax/swing/RepaintManager.java

Print this page

        

*** 180,192 **** /** * Runnable used to process all repaint/revalidate requests. */ private final ProcessingRunnable processingRunnable; ! private final static JavaSecurityAccess javaSecurityAccess = SharedSecrets.getJavaSecurityAccess(); static { SwingAccessor.setRepaintManagerAccessor(new SwingAccessor.RepaintManagerAccessor() { @Override public void addRepaintListener(RepaintManager rm, RepaintListener l) { --- 180,199 ---- /** * Runnable used to process all repaint/revalidate requests. */ private final ProcessingRunnable processingRunnable; ! private static final JavaSecurityAccess javaSecurityAccess = SharedSecrets.getJavaSecurityAccess(); + /** + * Listener installed to detect display changes. When display changes, + * schedules a callback to notify all RepaintManagers of the display + * changes. + */ + private static final DisplayChangedListener displayChangedHandler = + new DisplayChangedHandler(); static { SwingAccessor.setRepaintManagerAccessor(new SwingAccessor.RepaintManagerAccessor() { @Override public void addRepaintListener(RepaintManager rm, RepaintListener l) {
*** 224,235 **** HANDLE_TOP_LEVEL_PAINT = "true".equals(AccessController.doPrivileged( new GetPropertyAction("swing.handleTopLevelPaint", "true"))); GraphicsEnvironment ge = GraphicsEnvironment. getLocalGraphicsEnvironment(); if (ge instanceof SunGraphicsEnvironment) { ! ((SunGraphicsEnvironment)ge).addDisplayChangedListener( ! new DisplayChangedHandler()); } Toolkit tk = Toolkit.getDefaultToolkit(); if ((tk instanceof SunToolkit) && ((SunToolkit) tk).isSwingBackbufferTranslucencySupported()) { volatileBufferType = Transparency.TRANSLUCENT; --- 231,242 ---- HANDLE_TOP_LEVEL_PAINT = "true".equals(AccessController.doPrivileged( new GetPropertyAction("swing.handleTopLevelPaint", "true"))); GraphicsEnvironment ge = GraphicsEnvironment. getLocalGraphicsEnvironment(); if (ge instanceof SunGraphicsEnvironment) { ! ((SunGraphicsEnvironment) ge).addDisplayChangedListener( ! displayChangedHandler); } Toolkit tk = Toolkit.getDefaultToolkit(); if ((tk instanceof SunToolkit) && ((SunToolkit) tk).isSwingBackbufferTranslucencySupported()) { volatileBufferType = Transparency.TRANSLUCENT;
*** 1677,1698 **** * changes. Only one DisplayChangedHandler is ever installed. The * singleton instance will schedule notification for all AppContexts. */ private static final class DisplayChangedHandler implements DisplayChangedListener { public void displayChanged() { scheduleDisplayChanges(); } public void paletteChanged() { } ! private void scheduleDisplayChanges() { // To avoid threading problems, we notify each RepaintManager // on the thread it was created on. ! for (Object c : AppContext.getAppContexts()) { ! AppContext context = (AppContext) c; synchronized(context) { if (!context.isDisposed()) { EventQueue eventQueue = (EventQueue)context.get( AppContext.EVENT_QUEUE_KEY); if (eventQueue != null) { --- 1684,1710 ---- * changes. Only one DisplayChangedHandler is ever installed. The * singleton instance will schedule notification for all AppContexts. */ private static final class DisplayChangedHandler implements DisplayChangedListener { + // Empty non private constructor was added because access to this + // class shouldn't be emulated by a synthetic accessor method. + DisplayChangedHandler() { + super(); + } + public void displayChanged() { scheduleDisplayChanges(); } public void paletteChanged() { } ! private static void scheduleDisplayChanges() { // To avoid threading problems, we notify each RepaintManager // on the thread it was created on. ! for (AppContext context : AppContext.getAppContexts()) { synchronized(context) { if (!context.isDisposed()) { EventQueue eventQueue = (EventQueue)context.get( AppContext.EVENT_QUEUE_KEY); if (eventQueue != null) {