Java Code Examples for java.awt.Window#getName()

The following examples show how to use java.awt.Window#getName() . 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: Test6541987.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 2
Source File: AbstractDockingTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Waits for a window with the given name.
 *
 * @param name The name of the window for which to search
 * @return The window, if found, null otherwise
 */
public static Window waitForWindowByName(String name) {

	int time = 0;
	int timeout = DEFAULT_WAIT_TIMEOUT;
	while (time <= timeout) {
		Set<Window> allWindows = getAllWindows();
		for (Window window : allWindows) {
			String windowName = window.getName();
			if (name.equals(windowName) && window.isVisible()) {
				return window;
			}

			time += sleep(DEFAULT_WAIT_DELAY);
		}
	}

	throw new AssertionFailedError("Timed-out waiting for window with name '" + name + "'");
}
 
Example 3
Source File: Test6541987.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 4
Source File: Test6541987.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 5
Source File: Test6541987.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 6
Source File: Test6541987.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 7
Source File: Test6541987.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    robot.waitForIdle();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    robot.waitForIdle();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 8
Source File: Test6541987.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 9
Source File: Test6541987.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 10
Source File: Test6541987.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 11
Source File: Test6541987.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 12
Source File: Test6541987.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 13
Source File: Test6541987.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 14
Source File: Test6541987.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws AWTException {
    robot = new Robot();
    // test escape after selection
    start();
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // test double escape after editing
    start();
    click(KeyEvent.VK_1);
    click(KeyEvent.VK_0);
    click(KeyEvent.VK_ESCAPE);
    click(KeyEvent.VK_ESCAPE);
    toolkit.realSync();
    // all windows should be closed
    for (Window window : Window.getWindows()) {
        if (window.isVisible()) {
            throw new Error("found visible window: " + window.getName());
        }
    }
}
 
Example 15
Source File: LifecycleManager.java    From raccoon4 with Apache License 2.0 6 votes vote down vote up
/**
 * Lookup a secondary window by its identifier.
 * 
 * @param id
 *          window identifier
 * @return the window instance.
 */
public Window getWindow(String id) {
	Window ret = secondaries.get(id);
	if (ret == null) {
		ret = lifecycle.onCreateSecondaryWindow(globals, id);
		if (ret instanceof JFrame) {
			((JFrame) ret).setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		}
		if (ret.getName() == null) {
			ret.setName(id); // for unit testing.
		}
		secondaries.put(id, ret);
		ret.addWindowListener(new LifecycleBackend(this));
	}
	return ret;
}
 
Example 16
Source File: PresentationModelBase.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
private String getWindowName(Window ret) {
	if (ret instanceof JFrame) {
		return ((JFrame) ret).getTitle();
	}
	if (ret instanceof JDialog) {
		return ((JDialog) ret).getTitle();
	}
	return ret.getName();
}