// 1. Check that button press doesn't cause ungrab
Util.clickOnComp(b, robot);
Util.waitForIdle(robot);
checkAndThrow(buttonPressed, "Error: Button can not be pressed"); if (ungrabbed) {
passed = false;
tk.grab(w);
System.err.println("Failure: [1] Press inside of Window (on Button) caused ungrab");
}
// 2. Check that press on the window itself doesn't cause ungrab
Util.clickOnComp(w, robot);
Util.waitForIdle(robot);
checkAndThrow(windowPressed, "Error: Window can't be pressed"); if (ungrabbed) {
passed = false;
tk.grab(w);
System.err.println("Failure: [2] Press inside of Window caused ungrab");
}
// 3. Check that press on the frame causes ungrab, event must be dispatched
Util.clickOnComp(f, robot);
Util.waitForIdle(robot);
checkAndThrow(framePressed, "Error: Frame can't be pressed"); if (!ungrabbed) {
passed = false;
System.err.println("Failure: [3] Press inside of Frame didn't cause ungrab");
}
ungrabbed = false;
tk.grab(w);
// 4. Check that press on the frame's title causes ungrab
Util.clickOnTitle(f, robot);
Util.waitForIdle(robot); if (!ungrabbed) {
passed = false;
System.err.println("Failure: [4] Press inside of Frame's title didn't cause ungrab");
}
ungrabbed = false;
tk.grab(w);
// 5. Check that press on the other frame's title causes ungrab
f1.setVisible(true);
Util.waitForIdle(robot);
Util.clickOnTitle(f1, robot); if (!ungrabbed) {
passed = false;
System.err.println("Failure: [5] Press inside of other Frame's title didn't cause ungrab");
}
f.requestFocus(); // restore focus
Util.waitForIdle(robot); if (!f.hasFocus()) {
System.err.println("Error: Frame can't be focused");
}
ungrabbed = false;
tk.grab(w);
// 6. Check that press on the outside area causes ungrab
Point loc = f.getLocationOnScreen();
robot.mouseMove(loc.x + 100, loc.y + f.getSize().height + 10);
Util.waitForIdle(robot);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.delay(50);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
Util.waitForIdle(robot); if (!ungrabbed) {
passed = false;
System.err.println("Failure: [6] Press on the outside area didn't cause ungrab");
}
ungrabbed = false;
tk.grab(w);
// 7. Check that disposing the window causes ungrab
w.dispose();
Util.waitForIdle(robot); if (!ungrabbed) {
passed = false;
System.err.println("Failure: [7] Window disposal didn't cause ungrab");
}
ungrabbed = false;
// 8. Check that mouse click on subwindow does not cause ungrab
frame.setVisible(true);
window1.setVisible(true);
window2.setVisible(true);
Util.waitForIdle(robot);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.