Java Code Examples for java.awt.Dialog#isVisible()
The following examples show how to use
java.awt.Dialog#isVisible() .
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: MissingEventsOnModalDialogTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example 2
Source File: MissingEventsOnModalDialogTest.java From hottub with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example 3
Source File: MissingEventsOnModalDialogTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example 4
Source File: MissingEventsOnModalDialogTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Robot robot = new Robot(); robot.setAutoDelay(50); robot.waitForIdle(); robot.delay(200); Point point = getCenterPoint(dialog); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example 5
Source File: MissingEventsOnModalDialogTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example 6
Source File: MissingEventsOnModalDialogTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example 7
Source File: MissingEventsOnModalDialogTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example 8
Source File: ModalDialogOrderingTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 9
Source File: I18nTestWizardAction.java From netbeans with Apache License 2.0 | 5 votes |
/** * We create non-modal but not rentrant dialog. Wait until * previous one is closed. */ protected boolean enable(Node[] activatedNodes) { if (Util.wizardEnabled(activatedNodes) == false) { return false; } Dialog previous = (Dialog) dialogWRef.get(); if (previous == null) return true; return previous.isVisible() == false; }
Example 10
Source File: ModalDialogOrderingTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 11
Source File: ModalDialogOrderingTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 12
Source File: ModalDialogOrderingTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 13
Source File: ModalDialogOrderingTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 14
Source File: ModalDialogOrderingTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 15
Source File: ModalDialogOrderingTest.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 16
Source File: ModalDialogOrderingTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 17
Source File: ModalDialogOrderingTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 18
Source File: ModalDialogOrderingTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 19
Source File: ModalDialogOrderingTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void runTest(Dialog dialog, Frame frame) { try { Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { sleep(); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); sleep(); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); dialog.dispose(); frame.dispose(); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example 20
Source File: ModalDialogOrderingTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static void runTest(Dialog dialog, Frame frame) { try { ExtendedRobot robot = new ExtendedRobot(); robot.setAutoDelay(50); robot.mouseMove(300, 300); while (!dialog.isVisible()) { robot.waitForIdle(1000); } Rectangle dialogBounds = dialog.getBounds(); Rectangle frameBounds = frame.getBounds(); int y1 = dialogBounds.y + dialogBounds.height; int y2 = frameBounds.y + frameBounds.height; int clickX = frameBounds.x + frameBounds.width / 2; int clickY = y1 + (y2 - y1) / 2; robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); robot.waitForIdle(1000); int colorX = dialogBounds.x + dialogBounds.width / 2; int colorY = dialogBounds.y + dialogBounds.height / 2; Color color = robot.getPixelColor(colorX, colorY); if (!DIALOG_COLOR.equals(color)) { throw new RuntimeException("The frame is on top" + " of the modal dialog!"); }else{ frame.dispose(); dialog.dispose(); } } catch (Exception ex) { throw new RuntimeException(ex); } }