Java Code Examples for java.awt.AWTException#getMessage()

The following examples show how to use java.awt.AWTException#getMessage() . 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: ActionEventTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public ActionEventTest() {
    try {
        robot = new Robot();
        robot.setAutoDelay(100);
        robot.setAutoWaitForIdle(true);
    } catch(AWTException e) {
        throw new RuntimeException(e.getMessage());
    }

    list = new List(1, false);
    list.add("0");
    add(list);
    setSize(400,400);
    setLayout(new FlowLayout());
    pack();
    setVisible(true);
}
 
Example 2
Source File: ItemEventTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public ItemEventTest()
{
    try {
        robot = new Robot();
    } catch(AWTException e) {
        throw new RuntimeException(e.getMessage());
    }
    expectedSelectionOrder = "01230123";

    list = new List(4, true);
    list.add("0");
    list.add("1");
    list.add("2");
    list.add("3");

    add(list);
    setSize(400,400);
    setLayout(new FlowLayout());
    pack();
    setVisible(true);
    robot.waitForIdle();
}
 
Example 3
Source File: ActionEventTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public ActionEventTest() {
    try {
        robot = new Robot();
    } catch(AWTException e) {
        throw new RuntimeException(e.getMessage());
    }

    button = new Button("ClickMe");
    button.setEnabled(true);

    instructions = new TextArea(10, 50);
    instructions.setText(
    " This is a manual test\n" +
    " Keep the Alt, Shift & Ctrl Keys pressed &\n" +
    " Click 'ClickMe' button with left mouse button\n" +
    " Test exits automatically after mouse click.");

    add(button);
    add(instructions);
    setSize(400,400);
    setLayout(new FlowLayout());
    pack();
    setVisible(true);
    robot.waitForIdle();

    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            int md = ae.getModifiers();
            int expectedMask = ActionEvent.ALT_MASK | ActionEvent.CTRL_MASK
                    | ActionEvent.SHIFT_MASK;

            isProgInterruption = true;
            mainThread.interrupt();
            if ((md & expectedMask) != expectedMask) {
                throw new RuntimeException("Action Event modifiers"
                    + " are not set correctly.");
            }
        }
    });
}