test/javax/swing/ToolTipManager/7123767/bug7123767.java

Print this page

        

*** 26,37 **** @summary Wrong tooltip location in Multi-Monitor configurations @author Vladislav Karnaukhov @run main bug7123767 */ - import sun.awt.SunToolkit; - import javax.swing.*; import javax.swing.plaf.metal.MetalLookAndFeel; import java.awt.*; import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; --- 26,35 ----
*** 158,198 **** }); } // Moves mouse pointer to the corners of every GraphicsConfiguration 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(); } } } private static void glide(int x0, int y0, int x1, int y1) throws AWTException { --- 156,198 ---- }); } // Moves mouse pointer to the corners of every GraphicsConfiguration private static void testToolTip() throws AWTException { ! ! robot = new Robot(); ! robot.setAutoDelay(20); ! robot.waitForIdle(); 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.getDefaultToolkit().getScreenInsets(config); adjustInsets(rect, insets); // Upper left glide(rect.x + rect.width / 2, rect.y + rect.height / 2, rect.x + MARGIN, rect.y + MARGIN); ! robot.waitForIdle(); // Lower left glide(rect.x + rect.width / 2, rect.y + rect.height / 2, rect.x + MARGIN, rect.y + rect.height - MARGIN); ! robot.waitForIdle(); // Upper right glide(rect.x + rect.width / 2, rect.y + rect.height / 2, rect.x + rect.width - MARGIN, rect.y + MARGIN); ! robot.waitForIdle(); // Lower right glide(rect.x + rect.width / 2, rect.y + rect.height / 2, rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN); ! robot.waitForIdle(); } } } private static void glide(int x0, int y0, int x1, int y1) throws AWTException {