test/java/awt/TrayIcon/ActionCommand/ActionCommand.java

Print this page




  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 import java.awt.*;
  25 import java.awt.image.BufferedImage;
  26 
  27 /*
  28  * @test
  29  * @summary Check the return value of the getActionCommand method
  30  *          of the ActionEvent triggered when TrayIcon is double clicked
  31  *          (single clicked, on Mac)
  32  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  33  * @library ../../../../lib/testlibrary ../
  34  * @compile/module=java.desktop java/awt/Helper.java

  35  * @build ExtendedRobot SystemTrayIconHelper
  36  * @run main ActionCommand
  37  */
  38 
  39 public class ActionCommand {
  40 
  41     TrayIcon icon;
  42     ExtendedRobot robot;
  43 
  44     boolean actionPerformed = false;
  45     Object actionLock = new Object();
  46     String actionCommand = null;
  47     static boolean isMacOS = false;
  48 
  49     public static void main(String[] args) throws Exception {
  50         if (! SystemTray.isSupported()) {
  51             System.out.println("SystemTray not supported on the platform under test. " +
  52                     "Marking the test passed");
  53         } else {
  54             if (System.getProperty("os.name").toLowerCase().startsWith("win")) {




  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 import java.awt.*;
  25 import java.awt.image.BufferedImage;
  26 
  27 /*
  28  * @test
  29  * @summary Check the return value of the getActionCommand method
  30  *          of the ActionEvent triggered when TrayIcon is double clicked
  31  *          (single clicked, on Mac)
  32  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  33  * @library ../../../../lib/testlibrary ../
  34  * @library /java/awt/patchlib
  35  * @build java.desktop/java.awt.Helper
  36  * @build ExtendedRobot SystemTrayIconHelper
  37  * @run main ActionCommand
  38  */
  39 
  40 public class ActionCommand {
  41 
  42     TrayIcon icon;
  43     ExtendedRobot robot;
  44 
  45     boolean actionPerformed = false;
  46     Object actionLock = new Object();
  47     String actionCommand = null;
  48     static boolean isMacOS = false;
  49 
  50     public static void main(String[] args) throws Exception {
  51         if (! SystemTray.isSupported()) {
  52             System.out.println("SystemTray not supported on the platform under test. " +
  53                     "Marking the test passed");
  54         } else {
  55             if (System.getProperty("os.name").toLowerCase().startsWith("win")) {