test/java/awt/TrayIcon/ActionEventMask/ActionEventMask.java

Print this page




  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 import java.awt.*;
  25 import java.awt.event.*;
  26 import java.awt.image.BufferedImage;
  27 
  28 /*
  29  * @test
  30  * @summary Check if ActionEvent triggered when a TrayIcon is double
  31  *          (single, on Mac) clicked is visible by an AWTEventListener
  32  *          added to the Toolkit. It also checks if all listeners are
  33  *          triggered when multiple AWTEventListeners and ActionListeners
  34  *          are added.
  35  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)

  36  * @library ../../../../lib/testlibrary ../
  37  * @compile/module=java.desktop java/awt/Helper.java
  38  * @build ExtendedRobot SystemTrayIconHelper
  39  * @run main ActionEventMask
  40  */
  41 
  42 public class ActionEventMask {
  43 
  44     private Image image;
  45 
  46     TrayIcon icon;
  47     ExtendedRobot robot;
  48 
  49     boolean actionPerformed = false;
  50     boolean listenersInvoked = false;
  51     Object actionLock = new Object();
  52     Object listenersLock = new Object();
  53     static boolean isMacOS = false;
  54     static final int clickDelay = 50;
  55 
  56     ActionListener[] listeners;
  57     boolean[] listenerStatus;




  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 import java.awt.*;
  25 import java.awt.event.*;
  26 import java.awt.image.BufferedImage;
  27 
  28 /*
  29  * @test
  30  * @summary Check if ActionEvent triggered when a TrayIcon is double
  31  *          (single, on Mac) clicked is visible by an AWTEventListener
  32  *          added to the Toolkit. It also checks if all listeners are
  33  *          triggered when multiple AWTEventListeners and ActionListeners
  34  *          are added.
  35  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  36  * @library /java/awt/patchlib
  37  * @library ../../../../lib/testlibrary ../
  38  * @build java.desktop/java.awt.Helper
  39  * @build ExtendedRobot SystemTrayIconHelper
  40  * @run main ActionEventMask
  41  */
  42 
  43 public class ActionEventMask {
  44 
  45     private Image image;
  46 
  47     TrayIcon icon;
  48     ExtendedRobot robot;
  49 
  50     boolean actionPerformed = false;
  51     boolean listenersInvoked = false;
  52     Object actionLock = new Object();
  53     Object listenersLock = new Object();
  54     static boolean isMacOS = false;
  55     static final int clickDelay = 50;
  56 
  57     ActionListener[] listeners;
  58     boolean[] listenerStatus;