test/java/awt/Window/Grab/GrabTest.java

Print this page

        

*** 63,82 **** } } }, sun.awt.SunToolkit.GRAB_EVENT_MASK); f = new Frame("Frame"); ! f.setSize(200, 200); f.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println(e); framePressed = true; } }); f1 = new Frame("OtherFrame"); ! f1.setBounds(600, 100, 200, 200); w = new Window(f); w.setLayout(new FlowLayout()); b = new Button("Press"); b.addActionListener(new ActionListener() { --- 63,82 ---- } } }, sun.awt.SunToolkit.GRAB_EVENT_MASK); f = new Frame("Frame"); ! f.setBounds(0, 0, 300, 300); f.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println(e); framePressed = true; } }); f1 = new Frame("OtherFrame"); ! f1.setBounds(700, 100, 200, 200); w = new Window(f); w.setLayout(new FlowLayout()); b = new Button("Press"); b.addActionListener(new ActionListener() {
*** 84,94 **** System.out.println(e); buttonPressed = true; } }); w.add(b); ! w.setBounds(300, 100, 200, 200); w.setBackground(Color.blue); w.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println(e); windowPressed = true; --- 84,94 ---- System.out.println(e); buttonPressed = true; } }); w.add(b); ! w.setBounds(400, 100, 200, 200); w.setBackground(Color.blue); w.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println(e); windowPressed = true;
*** 173,183 **** 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 + 300); robot.mousePress(InputEvent.BUTTON1_MASK); robot.delay(50); robot.mouseRelease(InputEvent.BUTTON1_MASK); Util.waitForIdle(robot); if (!ungrabbed) { --- 173,184 ---- 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 + 1); ! Util.waitForIdle(robot); robot.mousePress(InputEvent.BUTTON1_MASK); robot.delay(50); robot.mouseRelease(InputEvent.BUTTON1_MASK); Util.waitForIdle(robot); if (!ungrabbed) {