sun.awt.DisplayChangedListener Java Examples

The following examples show how to use sun.awt.DisplayChangedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JLightweightFrame.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #2
Source File: WToolkit.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static public void displayChanged() {
    final Runnable runnable = () -> {
        Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (lge instanceof DisplayChangedListener) {
            ((DisplayChangedListener) lge).displayChanged();
        }
    };
    if (AppContext.getAppContext() != null) {
        // Common case, standalone application
        EventQueue.invokeLater(runnable);
    } else {
        if (displayChangeExecutor == null) {
            // No synchronization, called on the Toolkit thread only
            displayChangeExecutor = Executors.newFixedThreadPool(1, r -> {
                Thread t = Executors.defaultThreadFactory().newThread(r);
                t.setDaemon(true);
                return t;
            });
        }
        displayChangeExecutor.submit(runnable);
    }
}
 
Example #3
Source File: JLightweightFrame.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #4
Source File: JLightweightFrame.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #5
Source File: WToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
static public void displayChanged() {
    final Runnable runnable = () -> {
        Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (lge instanceof DisplayChangedListener) {
            ((DisplayChangedListener) lge).displayChanged();
        }
    };
    if (AppContext.getAppContext() != null) {
        // Common case, standalone application
        EventQueue.invokeLater(runnable);
    } else {
        if (displayChangeExecutor == null) {
            // No synchronization, called on the Toolkit thread only
            displayChangeExecutor = Executors.newFixedThreadPool(1, r -> {
                Thread t = Executors.defaultThreadFactory().newThread(r);
                t.setDaemon(true);
                return t;
            });
        }
        displayChangeExecutor.submit(runnable);
    }
}
 
Example #6
Source File: JLightweightFrame.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #7
Source File: JLightweightFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #8
Source File: WToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static public void displayChanged() {
    final Runnable runnable = () -> {
        Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (lge instanceof DisplayChangedListener) {
            ((DisplayChangedListener) lge).displayChanged();
        }
    };
    if (AppContext.getAppContext() != null) {
        // Common case, standalone application
        EventQueue.invokeLater(runnable);
    } else {
        if (displayChangeExecutor == null) {
            // No synchronization, called on the Toolkit thread only
            displayChangeExecutor = Executors.newFixedThreadPool(1, r -> {
                Thread t = Executors.defaultThreadFactory().newThread(r);
                t.setDaemon(true);
                return t;
            });
        }
        displayChangeExecutor.submit(runnable);
    }
}
 
Example #9
Source File: JLightweightFrame.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #10
Source File: JLightweightFrame.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #11
Source File: WToolkit.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static public void displayChanged() {
    final Runnable runnable = () -> {
        Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (lge instanceof DisplayChangedListener) {
            ((DisplayChangedListener) lge).displayChanged();
        }
    };
    if (AppContext.getAppContext() != null) {
        // Common case, standalone application
        EventQueue.invokeLater(runnable);
    } else {
        if (displayChangeExecutor == null) {
            // No synchronization, called on the Toolkit thread only
            displayChangeExecutor = Executors.newFixedThreadPool(1, r -> {
                Thread t = Executors.defaultThreadFactory().newThread(r);
                t.setDaemon(true);
                return t;
            });
        }
        displayChangeExecutor.submit(runnable);
    }
}
 
Example #12
Source File: JLightweightFrame.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #13
Source File: JLightweightFrame.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #14
Source File: JLightweightFrame.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyDisplayChanged(final int scaleFactor) {
    if (scaleFactor != this.scaleFactor) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactor);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactor = scaleFactor;
    }
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
    repaint();
}
 
Example #15
Source File: SunGraphicsEnvironment.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}
 
Example #16
Source File: DisplayChangesException.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testGE() {
    Object ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!(ge instanceof DisplayChangedListener)) {
        return;
    }
    ((DisplayChangedListener) ge).displayChanged();
}
 
Example #17
Source File: JLightweightFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
}
 
Example #18
Source File: SunGraphicsEnvironment.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}
 
Example #19
Source File: SunGraphicsEnvironment.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}
 
Example #20
Source File: JLightweightFrame.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
}
 
Example #21
Source File: JLightweightFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    if (getPeer() instanceof DisplayChangedListener) {
        ((DisplayChangedListener)getPeer()).displayChanged();
    }
}
 
Example #22
Source File: JLightweightFrame.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void notifyDisplayChanged(final double scaleFactorX,
                                                final double scaleFactorY) {
    if (Double.compare(scaleFactorX, this.scaleFactorX) != 0 ||
                     Double.compare(scaleFactorY, this.scaleFactorY) != 0) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactorX,
                                                              scaleFactorY);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactorX = scaleFactorX;
        this.scaleFactorY = scaleFactorY;

        if(isVisible()) {
            final Object peer =
                    AWTAccessor.getComponentAccessor().getPeer(this);
            if (peer instanceof DisplayChangedListener) {
                ((DisplayChangedListener) peer).displayChanged();
            }
            repaint();
        }
    }
}
 
Example #23
Source File: SunGraphicsEnvironment.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}
 
Example #24
Source File: SunGraphicsEnvironment.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}
 
Example #25
Source File: JLightweightFrame.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
    if (peer instanceof DisplayChangedListener) {
        ((DisplayChangedListener) peer).displayChanged();
    }
}
 
Example #26
Source File: JLightweightFrame.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void notifyDisplayChanged(final double scaleFactorX,
                                                final double scaleFactorY) {
    if (Double.compare(scaleFactorX, this.scaleFactorX) != 0 ||
                     Double.compare(scaleFactorY, this.scaleFactorY) != 0) {
        if (!copyBufferEnabled) content.paintLock();
        try {
            if (bbImage != null) {
                resizeBuffer(getWidth(), getHeight(), scaleFactorX,
                                                              scaleFactorY);
            }
        } finally {
            if (!copyBufferEnabled) content.paintUnlock();
        }
        this.scaleFactorX = scaleFactorX;
        this.scaleFactorY = scaleFactorY;

        if(isVisible()) {
            final Object peer =
                    AWTAccessor.getComponentAccessor().getPeer(this);
            if (peer instanceof DisplayChangedListener) {
                ((DisplayChangedListener) peer).displayChanged();
            }
            repaint();
        }
    }
}
 
Example #27
Source File: SunGraphicsEnvironment.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}
 
Example #28
Source File: SunGraphicsEnvironment.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}
 
Example #29
Source File: JLightweightFrame.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
    if (peer instanceof DisplayChangedListener) {
        ((DisplayChangedListener) peer).displayChanged();
    }
}
 
Example #30
Source File: SunGraphicsEnvironment.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From the DisplayChangedListener interface; called
 * when the display mode has been changed.
 */
public void displayChanged() {
    // notify screens in device array to do display update stuff
    for (GraphicsDevice gd : getScreenDevices()) {
        if (gd instanceof DisplayChangedListener) {
            ((DisplayChangedListener) gd).displayChanged();
        }
    }

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // SurfaceDataProxies) about the display change event
    displayChanger.notifyListeners();
}