./test/java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java

Print this page
rev 293 : Revised check, if frame is placed at the center of the proper screen in
multi-screen environment.

*** 48,58 **** { Robot r = Util.createRobot(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ! System.out.println("Center point: " + ge.getCenterPoint()); GraphicsDevice[] gds = ge.getScreenDevices(); GraphicsDevice gdDef = ge.getDefaultScreenDevice(); GraphicsConfiguration gcDef = gdDef.getDefaultConfiguration(); --- 48,59 ---- { Robot r = Util.createRobot(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ! Point centerPoint = ge.getCenterPoint(); ! System.out.println("Center point: " + centerPoint); GraphicsDevice[] gds = ge.getScreenDevices(); GraphicsDevice gdDef = ge.getDefaultScreenDevice(); GraphicsConfiguration gcDef = gdDef.getDefaultConfiguration();
*** 75,86 **** FRAME_WIDTH, FRAME_HEIGHT); // second, check setLocationRelativeTo(invisible) f.setLocationRelativeTo(f2); Util.waitForIdle(r); ! checkLocation(f, new Point(gcBounds.x + gcBounds.width / 2, ! gcBounds.y + gcBounds.height / 2)); // third, check setLocationRelativeTo(visible) f2.setVisible(true); Util.waitForIdle(r); Point f2Loc = f2.getLocationOnScreen(); --- 76,86 ---- FRAME_WIDTH, FRAME_HEIGHT); // second, check setLocationRelativeTo(invisible) f.setLocationRelativeTo(f2); Util.waitForIdle(r); ! checkLocation(f, centerPoint); // third, check setLocationRelativeTo(visible) f2.setVisible(true); Util.waitForIdle(r); Point f2Loc = f2.getLocationOnScreen();