Java Code Examples for java.awt.Frame#getLocationOnScreen()
The following examples show how to use
java.awt.Frame#getLocationOnScreen() .
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: MutterMaximizeTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 2
Source File: MutterMaximizeTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 3
Source File: MutterMaximizeTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 4
Source File: MutterMaximizeTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 5
Source File: MutterMaximizeTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 6
Source File: MutterMaximizeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 7
Source File: MutterMaximizeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 8
Source File: MutterMaximizeTest.java From hottub with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 9
Source File: MutterMaximizeTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 10
Source File: MutterMaximizeTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 11
Source File: MutterMaximizeTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 12
Source File: MutterMaximizeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 13
Source File: MutterMaximizeTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static Thread startRegTest(final Frame f) { Thread robot = new Thread(new Runnable() { public void run() { Robot r = Util.createRobot(); dragWindow(f, 100, 100, r); // wait for the location to be set. sleepFor(2000); final Point l2 = f.getLocationOnScreen(); // double click should maximize the frame doubleClick(r); // wait for location again. sleepFor(2000); final Point l3 = f.getLocationOnScreen(); if (l3.equals(l2)) { throw new RuntimeException("Bad location after maximize. Window location has not moved"); } } }); return robot; }
Example 14
Source File: RobotCrash.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void robotKeyPressTest() throws Exception { SwingUtilities.invokeAndWait(() -> { frame = new Frame(); frame.setSize(300, 300); frame.setVisible(true); }); Robot robot = new Robot(); robot.waitForIdle(); Point pt = frame.getLocationOnScreen(); robot.mouseMove(((int) pt.getX() + frame.getWidth()) / 2, ((int) pt.getY() + frame.getHeight()) / 2); robot.waitForIdle(); robot.mousePress(InputEvent.BUTTON1_MASK); robot.waitForIdle(); robot.mouseRelease(InputEvent.BUTTON1_MASK); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_ENTER); robot.waitForIdle(); robot.keyRelease(KeyEvent.VK_ENTER); robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { frame.dispose(); }); }
Example 15
Source File: ReportServerSettingsDlg.java From jclic with GNU General Public License v2.0 | 5 votes |
/** Creates new form ReportServerSettingsDlg */ public ReportServerSettingsDlg(Frame parent, boolean modal, Options options) { super(parent, modal); this.options = options; msg = options.getMessages(); initComponents(); result = false; Point p = parent.getLocationOnScreen(); setLocation(p.x + 80, p.y + 30); }
Example 16
Source File: Button2DragTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void run() { frame = new Frame(); final DragSourceListener dragSourceListener = new DragSourceAdapter() { public void dragDropEnd(DragSourceDropEvent e) { dropSuccess = e.getDropSuccess(); System.err.println("Drop was successful: " + dropSuccess); } }; DragGestureListener dragGestureListener = new DragGestureListener() { public void dragGestureRecognized(DragGestureEvent dge) { dge.startDrag(null, new StringSelection("OK"), dragSourceListener); } }; new DragSource().createDefaultDragGestureRecognizer(frame, DnDConstants.ACTION_MOVE, dragGestureListener); DropTargetAdapter dropTargetListener = new DropTargetAdapter() { public void drop(DropTargetDropEvent dtde) { dtde.acceptDrop(DnDConstants.ACTION_MOVE); dtde.dropComplete(true); System.err.println("Drop"); } }; new DropTarget(frame, dropTargetListener); //What would normally go into main() will probably go here. //Use System.out.println for diagnostic messages that you want //to read after the test is done. frame.setUndecorated(true); frame.setBounds(100, 100, 200, 200); frame.setLocationRelativeTo(null); frame.setVisible(true); Robot robot = Util.createRobot(); Util.waitForIdle(robot); Point startPoint = frame.getLocationOnScreen(); Point endPoint = new Point(startPoint); startPoint.translate(50, 50); endPoint.translate(150, 150); Util.drag(robot, startPoint, endPoint, InputEvent.BUTTON2_MASK); Util.waitForIdle(robot); robot.delay(500); if (dropSuccess) { System.err.println("test passed"); } else { throw new RuntimeException("test failed: drop was not successful"); } }