Java Code Examples for java.awt.Robot#mouseWheel()
The following examples show how to use
java.awt.Robot#mouseWheel() .
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: AbstractVTestCase.java From nebula with Eclipse Public License 2.0 | 6 votes |
public void mouseWheel(int count) { // Event event = new Event(); // event.type = SWT.MouseWheel; // event.data = VTracker.getActiveControl(); // event.detail = SWT.SCROLL_LINE; // event.x = x; // event.y = y; // event.count = count; // display.post(event); try { Robot robot = new Robot(); robot.mouseWheel(count); } catch (Exception e) { e.printStackTrace(); } pause(delay); }
Example 2
Source File: MouseWheelAbsXY.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void test(GraphicsConfiguration gc) throws AWTException { final Window frame = new Frame(gc); try { frame.addMouseWheelListener(e -> { wheelX = e.getXOnScreen(); wheelY = e.getYOnScreen(); done = true; }); frame.setSize(300, 300); frame.setVisible(true); final Robot robot = new Robot(); robot.setAutoDelay(50); robot.setAutoWaitForIdle(true); mouseX = frame.getX() + frame.getWidth() / 2; mouseY = frame.getY() + frame.getHeight() / 2; robot.mouseMove(mouseX, mouseY); robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.mouseWheel(10); validate(); } finally { frame.dispose(); } }
Example 3
Source File: HorizontalMouseWheelOnShiftPressed.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 4
Source File: HorizontalMouseWheelOnShiftPressed.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 5
Source File: bug8033000.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Robot robot = new Robot(); robot.setAutoDelay(50); SwingUtilities.invokeAndWait(bug8033000::createAndShowGUI); robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(true); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false); }
Example 6
Source File: HorizontalMouseWheelOnShiftPressed.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 7
Source File: HorizontalMouseWheelOnShiftPressed.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 8
Source File: HorizontalMouseWheelOnShiftPressed.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 9
Source File: HorizontalMouseWheelOnShiftPressed.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 10
Source File: HorizontalMouseWheelOnShiftPressed.java From hottub with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 11
Source File: HorizontalMouseWheelOnShiftPressed.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static void test(Robot robot) throws Exception { SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, false); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false, true); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true, false); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false, true); }
Example 12
Source File: bug8033000.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Robot robot = new Robot(); robot.setAutoDelay(50); SwingUtilities.invokeAndWait(bug8033000::createAndShowGUI); robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(true); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false); }
Example 13
Source File: bug8033000.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Robot robot = new Robot(); robot.setAutoDelay(50); SwingUtilities.invokeAndWait(bug8033000::createAndShowGUI); robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { Point locationOnScreen = scrollPane.getLocationOnScreen(); point = new Point( locationOnScreen.x + scrollPane.getWidth() / 2, locationOnScreen.y + scrollPane.getHeight() / 2); }); robot.mouseMove(point.x, point.y); robot.waitForIdle(); // vertical scroll bar is enabled initScrollPane(true, false); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true); // vertical scroll bar is enabled + shift initScrollPane(true, false); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(true); // horizontal scroll bar is enabled initScrollPane(false, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(false); // horizontal scroll bar is enabled + shift initScrollPane(false, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false); // both scroll bars are enabled initScrollPane(true, true); robot.waitForIdle(); robot.mouseWheel(delta); robot.waitForIdle(); checkScrollPane(true); // both scroll bars are enabled + shift initScrollPane(true, true); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); robot.mouseWheel(delta); robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); checkScrollPane(false); }