< prev index next >

test/jdk/java/awt/event/MouseEvent/MouseClickTest/MouseClickTest.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25   test

  26   @bug 6267983
  27   @summary PIT: MouseClicked is triggered when the mouse is released outside the tray icon, Win32
  28   @author dmitry.cherepanov@... area=awt.event
  29   @run applet MouseClickTest.html

  30 */
  31 
  32 import java.applet.Applet;
  33 import java.awt.*;
  34 import java.awt.event.*;
  35 import java.util.concurrent.atomic.AtomicInteger;
  36 
  37 import test.java.awt.regtesthelpers.Util;
  38 
  39 public class MouseClickTest extends Applet
  40 {
  41     private static final int TIMEOUT = 3000;
  42 
  43     public void init()
  44     {
  45         setLayout (new BorderLayout ());
  46     }
  47 
  48     public void start ()
  49     {
  50         setSize (200,200);
  51         setVisible(true);
  52         validate();
  53 
  54         runTests();
  55     }
  56 
  57     public static final void main(String args[])
  58     {
  59         MouseClickTest test = new MouseClickTest();
  60         test.init();
  61         test.start();
  62     }
  63 
  64     void runTests()
  65     {
  66         Frame frame = new Frame("frame");
  67         frame.setBounds(100, 100, 100, 100);
  68         frame.setVisible(true);
  69         frame.validate();
  70         Util.waitTillShown(frame);
  71 
  72         Robot robot = Util.createRobot();
  73         robot.setAutoDelay(10);
  74 
  75         oneButtonPressRelease(frame, robot, false, 1);
  76         oneButtonPressRelease(frame, robot, true, 0);
  77         twoButtonPressRelease(frame, robot, false, 2);
  78         twoButtonPressRelease(frame, robot, true, 1);
  79     }
  80 




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25   @test
  26   @key headful
  27   @bug 6267983
  28   @summary PIT: MouseClicked is triggered when the mouse is released outside the tray icon, Win32
  29   @library    ../../../regtesthelpers
  30   @build      Util
  31   @run main MouseClickTest
  32 */
  33 

  34 import java.awt.*;
  35 import java.awt.event.*;
  36 import java.util.concurrent.atomic.AtomicInteger;
  37 
  38 import test.java.awt.regtesthelpers.Util;
  39 
  40 public class MouseClickTest
  41 {
  42     private static final int TIMEOUT = 3000;
  43 





  44     public void start ()
  45     {




  46         runTests();
  47     }
  48 
  49     public static final void main(String args[])
  50     {
  51         MouseClickTest test = new MouseClickTest();

  52         test.start();
  53     }
  54 
  55     void runTests()
  56     {
  57         Frame frame = new Frame("frame");
  58         frame.setBounds(100, 100, 100, 100);
  59         frame.setVisible(true);
  60         frame.validate();
  61         Util.waitTillShown(frame);
  62 
  63         Robot robot = Util.createRobot();
  64         robot.setAutoDelay(10);
  65 
  66         oneButtonPressRelease(frame, robot, false, 1);
  67         oneButtonPressRelease(frame, robot, true, 0);
  68         twoButtonPressRelease(frame, robot, false, 2);
  69         twoButtonPressRelease(frame, robot, true, 1);
  70     }
  71 


< prev index next >