Java Code Examples for sun.awt.SunToolkit#getScreenInsets()

The following examples show how to use sun.awt.SunToolkit#getScreenInsets() . 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: bug6694823.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 2
Source File: bug6694823.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 3
Source File: bug6694823.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 4
Source File: bug7123767.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 5
Source File: bug6694823.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 6
Source File: bug7123767.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 7
Source File: bug6694823.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 8
Source File: bug7123767.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 9
Source File: bug6694823.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 10
Source File: bug7123767.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 11
Source File: bug6694823.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 12
Source File: bug7123767.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 13
Source File: bug6694823.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 14
Source File: bug7123767.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 15
Source File: bug7123767.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 16
Source File: bug7123767.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 17
Source File: bug6694823.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 18
Source File: bug7123767.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}
 
Example 19
Source File: bug6694823.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createGui();
        }
    });

    toolkit.realSync();

    // Get screen insets
    screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
    if (screenInsets.bottom == 0) {
        // This test is only for configurations with taskbar on the bottom
        return;
    }

    System.setSecurityManager(new SecurityManager(){

        private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();

        @Override
        public void checkPermission(Permission perm) {
            if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
                throw new SecurityException();
            }
        }

    });

    // Show popup as if from an applet
    // The popup shouldn't overlap the task bar. It should be shifted up.
    checkPopup();

}
 
Example 20
Source File: bug7123767.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testToolTip() throws AWTException {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = environment.getScreenDevices();
    for (GraphicsDevice device : devices) {
        GraphicsConfiguration[] configs = device.getConfigurations();
        for (GraphicsConfiguration config : configs) {
            Rectangle rect = config.getBounds();
            Insets insets = toolkit.getScreenInsets(config);
            adjustInsets(rect, insets);

            // Upper left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower left
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();

            // Upper right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + MARGIN);
            toolkit.realSync();

            // Lower right
            glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                    rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
            toolkit.realSync();
        }
    }
}