< prev index next >

test/java/awt/TrayIcon/TrayIconEventModifiers/TrayIconEventModifiersTest.java

Print this page




 104             if (System.getProperty("os.name").indexOf("Sun") != -1 &&
 105                     System.getProperty("os.arch").indexOf("sparc") != -1) {
 106                 keyTypes = new int[]{
 107                         KeyEvent.VK_SHIFT,
 108                         KeyEvent.VK_CONTROL,
 109                         KeyEvent.VK_META
 110                 };
 111 
 112                 keyNames = new String[]{
 113                         "SHIFT",
 114                         "CONTROL",
 115                         "META"
 116                 };
 117                 keyMasks = new int[]{
 118                         KeyEvent.SHIFT_DOWN_MASK,
 119                         KeyEvent.CTRL_DOWN_MASK,
 120                         KeyEvent.META_DOWN_MASK
 121                 };
 122             }
 123 








 124             new TrayIconEventModifiersTest().doTest();
 125         }
 126     }
 127 
 128     public TrayIconEventModifiersTest() throws Exception {
 129         robot = new ExtendedRobot();
 130         EventQueue.invokeAndWait(this::initializeGUI);
 131     }
 132 
 133     private void initializeGUI() {
 134 
 135         SystemTray tray = SystemTray.getSystemTray();
 136         icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
 137         icon.addMouseListener(new MouseAdapter() {
 138             public void mousePressed(MouseEvent event) {
 139                 if (!icon.equals(event.getSource()))
 140                     throw new RuntimeException("FAIL: mousePressed: MouseEvent.getSource " +
 141                             "did not return TrayIcon object");
 142 
 143                 mousePressed = true;




 104             if (System.getProperty("os.name").indexOf("Sun") != -1 &&
 105                     System.getProperty("os.arch").indexOf("sparc") != -1) {
 106                 keyTypes = new int[]{
 107                         KeyEvent.VK_SHIFT,
 108                         KeyEvent.VK_CONTROL,
 109                         KeyEvent.VK_META
 110                 };
 111 
 112                 keyNames = new String[]{
 113                         "SHIFT",
 114                         "CONTROL",
 115                         "META"
 116                 };
 117                 keyMasks = new int[]{
 118                         KeyEvent.SHIFT_DOWN_MASK,
 119                         KeyEvent.CTRL_DOWN_MASK,
 120                         KeyEvent.META_DOWN_MASK
 121                 };
 122             }
 123 
 124             if( System.getProperty("os.name").toLowerCase()
 125                     .contains("linux") && System.getProperty("os.version")
 126                     .toLowerCase().contains("el7") ) {
 127                 System.out.println("OEL 7 doesn't support click modifiers in " +
 128                         "systray. Skipped");
 129                 return;
 130             }
 131 
 132             new TrayIconEventModifiersTest().doTest();
 133         }
 134     }
 135 
 136     public TrayIconEventModifiersTest() throws Exception {
 137         robot = new ExtendedRobot();
 138         EventQueue.invokeAndWait(this::initializeGUI);
 139     }
 140 
 141     private void initializeGUI() {
 142 
 143         SystemTray tray = SystemTray.getSystemTray();
 144         icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
 145         icon.addMouseListener(new MouseAdapter() {
 146             public void mousePressed(MouseEvent event) {
 147                 if (!icon.equals(event.getSource()))
 148                     throw new RuntimeException("FAIL: mousePressed: MouseEvent.getSource " +
 149                             "did not return TrayIcon object");
 150 
 151                 mousePressed = true;


< prev index next >