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).

!752

p {
  //Check the SystemTray is supported
  if (!SystemTray.isSupported()) {
      System.out.println("SystemTray is not supported");
      return;
  }
  final PopupMenu popup = new PopupMenu();
  final TrayIcon trayIcon =
    new TrayIcon(imageIcon("#1003654").getImage());
  final SystemTray tray = SystemTray.getSystemTray();
 
  // Create a pop-up menu components
  MenuItem aboutItem = new MenuItem("About");
  CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
  CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
  Menu displayMenu = new Menu("Display");
  MenuItem errorItem = new MenuItem("Error");
  MenuItem warningItem = new MenuItem("Warning");
  MenuItem infoItem = new MenuItem("Info");
  MenuItem noneItem = new MenuItem("None");
  MenuItem exitItem = new MenuItem("Exit");
 
  //Add components to pop-up menu
  popup.add(aboutItem);
  popup.addSeparator();
  popup.add(cb1);
  popup.add(cb2);
  popup.addSeparator();
  popup.add(displayMenu);
  displayMenu.add(errorItem);
  displayMenu.add(warningItem);
  displayMenu.add(infoItem);
  displayMenu.add(noneItem);
  popup.add(exitItem);
 
  trayIcon.setPopupMenu(popup);
 
  tray.add(trayIcon);
}

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: 784 / 851
Referenced in: [show references]