當前位置: 首頁>>代碼示例>>Java>>正文


Java Dialog.isVisible方法代碼示例

本文整理匯總了Java中java.awt.Dialog.isVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.isVisible方法的具體用法?Java Dialog.isVisible怎麽用?Java Dialog.isVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Dialog的用法示例。


在下文中一共展示了Dialog.isVisible方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clickOnDialog

import java.awt.Dialog; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:MissingEventsOnModalDialogTest.java

示例2: clickOnDialog

import java.awt.Dialog; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:24,代碼來源:MissingEventsOnModalDialogTest.java

示例3: runTest

import java.awt.Dialog; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:41,代碼來源:ModalDialogOrderingTest.java

示例4: enable

import java.awt.Dialog; //導入方法依賴的package包/類
/** 
 * 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:I18nTestWizardAction.java

示例5: enable

import java.awt.Dialog; //導入方法依賴的package包/類
/** 
 * 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 = dialogWRef.get();
    if (previous == null) return true;
    return previous.isVisible() == false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:I18nWizardAction.java

示例6: runTest

import java.awt.Dialog; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:42,代碼來源:ModalDialogOrderingTest.java


注:本文中的java.awt.Dialog.isVisible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。