Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1003655 // System Tray Test

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1106L/8K/26K).

1  
!752
2  
3  
p {
4  
  //Check the SystemTray is supported
5  
  if (!SystemTray.isSupported()) {
6  
      System.out.println("SystemTray is not supported");
7  
      return;
8  
  }
9  
  final PopupMenu popup = new PopupMenu();
10  
  final TrayIcon trayIcon =
11  
    new TrayIcon(imageIcon("#1003654").getImage());
12  
  final SystemTray tray = SystemTray.getSystemTray();
13  
 
14  
  // Create a pop-up menu components
15  
  MenuItem aboutItem = new MenuItem("About");
16  
  CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
17  
  CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
18  
  Menu displayMenu = new Menu("Display");
19  
  MenuItem errorItem = new MenuItem("Error");
20  
  MenuItem warningItem = new MenuItem("Warning");
21  
  MenuItem infoItem = new MenuItem("Info");
22  
  MenuItem noneItem = new MenuItem("None");
23  
  MenuItem exitItem = new MenuItem("Exit");
24  
 
25  
  //Add components to pop-up menu
26  
  popup.add(aboutItem);
27  
  popup.addSeparator();
28  
  popup.add(cb1);
29  
  popup.add(cb2);
30  
  popup.addSeparator();
31  
  popup.add(displayMenu);
32  
  displayMenu.add(errorItem);
33  
  displayMenu.add(warningItem);
34  
  displayMenu.add(infoItem);
35  
  displayMenu.add(noneItem);
36  
  popup.add(exitItem);
37  
 
38  
  trayIcon.setPopupMenu(popup);
39  
 
40  
  tray.add(trayIcon);
41  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nnmtytuibrzp, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
1247 stefan Worx! 2016-07-25 12:16:04

add comment

Snippet ID: #1003655
Snippet name: System Tray Test
Eternal ID of this version: #1003655/1
Text MD5: 0d8ca10d1acb101d016e034cdde3afd2
Transpilation MD5: 7f24fa44df9a65340a58193b97c4dc77
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-25 12:15:09
Source code size: 1228 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 778 / 843
Referenced in: [show references]