Package java.awt

Examples of java.awt.TrayIcon


    // Update the desktop window
    GuiDesktop.setTitle(this, getFirstConnection().getProductID());

    // Update the tray icon
    TrayIcon tray = GuiDesktop.getTray();
    if(tray != null)
      tray.setToolTip(source.toString());
  }
View Full Code Here


    /** Creates new form MainFrame */
    public MainFrame() {
  listModel = new DefaultListModel();
  try {
      trayIcon = new TrayIcon(ImageIO.read(new File("ico.gif")), "MeganetSpy");
  } catch (IOException ex) {
      logger.error(ex.getMessage());
  }
  trayIcon.addActionListener(new ActionListener() {

View Full Code Here

   
    // If system tray is supported by OS
    if (SystemTray.isSupported()) {
     
      // Set Icon
      trayIcon = new TrayIcon(idleIcon,"Nebula Grid Cluster", createTrayPopup());
      trayIcon.setImageAutoSize(true);
      trayIcon.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
View Full Code Here

        if (this.pdash != null || this.icon != null) {
            logger.warning("SystemTrayIconJDK6Impl already initialized");
            return;
        }

        this.icon = new TrayIcon(getImage());
        this.isVisible = false;
        this.pdash = pdash;

        reminder = new Reminder(icon, pdash);
        imageHandler = new IconImageHandler(pdash, icon);
View Full Code Here

    popup.add(mi = new MenuItem(getResource("label_exit")));
    mi.setActionCommand("exit");
    mi.addActionListener(this);
    //java.net.URL u;
    // TODO icon can be customizable
    ti = new TrayIcon(Toolkit.getDefaultToolkit().getImage(
        getClass().getClassLoader().getResource("rogatkin/resource/tjws.gif")), "TJWS"+getResource("title_control_panel"), popup);
    //javax.swing.JOptionPane.showMessageDialog(null, String.format("Created sys tray icon with image%s%n",u));
    ti.setImageAutoSize(true);

    try {
View Full Code Here

  {
    final SystemTray tray = SystemTray.getSystemTray();
    final JPopupMenu popup = new JPopupMenu();
    ImageIcon icon = new ImageIcon(
            MainFrame.class.getResource("/images/flag-16.png"));
    final TrayIcon trayIcon = new TrayIcon(icon.getImage(),
            Constants.PROJECT_NAME);
   
    trayIcon.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        restoreFrame(mainFrame);
      }
    });
    trayIcon.addMouseListener(new MouseAdapter()
    {
      public void mouseReleased(MouseEvent e)
      {
        if (e.isPopupTrigger())
        {
          // popup.
          popup.setLocation(e.getX(), e.getY());
          popup.setInvoker(popup);
          popup.setVisible(true);
        }
      }
    });
   
    JMenuItem item = new JMenuItem("Restore", new ImageIcon(
            MainFrame.class.getResource("/images/flag-16.png")));
    item.setFont(new Font(null, Font.BOLD, 12));
    item.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        restoreFrame(mainFrame);
      }
    });
    popup.add(item);
   
    final JMenu servicePop = new JMenu("Services");
    final List<Pair<JMenuItem, String>> serviceMemus = new LinkedList<Pair<JMenuItem, String>>();
    String[] all = new String[] { "GAE", "C4", "SPAC" };
    for (int i = 0; i < all.length; i++)
    {
      final String handlerName = all[i];
      final JMenuItem serviceItem = new JMenuItem(all[i]);
      serviceItem.setFont(new Font(null, Font.BOLD, 12));
      serviceItem.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent e)
        {
          String choice = handlerName;
          if (handlerName.equalsIgnoreCase("SPAC"))
          {
            choice = "Auto";
            SPAC.spacEnbale = true;
          }else{
            SPAC.spacEnbale = false;
          }
          SnovaConfiguration.getInstance().setProxyService(choice);
          SnovaConfiguration.getInstance().save();
          updateProxyServiceMenus(serviceMemus);
        }
      });
      serviceMemus.add(new Pair<JMenuItem, String>(serviceItem,
              handlerName));
      updateProxyServiceMenus(serviceMemus);
      servicePop.add(serviceItem);
    }
    popup.add(servicePop);
    // item = new MenuItem("View Log");
    // item.setFont(new Font(null, Font.BOLD, 12));
    // item.addActionListener(new ActionListener() {
    // public void actionPerformed(ActionEvent e) {
    // try {
    // Desktop.getDesktop().browse(AppData.getLogHome().toURI());
    // } catch (IOException ex) {
    // Logger.getLogger(SysTray.class.getName()).log(Level.SEVERE, null,
    // ex);
    // }
    // }
    // });
    // popup.add(item);
   
    item = new JMenuItem("Exit", new ImageIcon(
            MainFrame.class.getResource("/images/exit.png")));
   
    item.setFont(new Font(null, Font.BOLD, 12));
    item.addActionListener(new ActionListener()
    {
     
      public void actionPerformed(ActionEvent e)
      {
        System.exit(1);
      }
    });
    popup.add(item);
    try
    {
      tray.add(trayIcon);
    }
    catch (Exception e)
    {
      // TODO: handle exception
    }
   
    trayIcon.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (!mainFrame.isVisible())
        {
View Full Code Here

 
 
  public JavaTray(Backend backend, Plugin plugin) throws AWTException{
    this.backend = backend;
    if(SystemTray.isSupported()){
      trayIcon = new TrayIcon(StatusIcons.getOfflineIcon().getImage(), "Jeti" + Start.OS2,makeMenu());
      trayIcon.addActionListener(plugin);
      //trayIcon.setImageAutoSize(true);
      SystemTray.getSystemTray().add(trayIcon);
    }
  }
View Full Code Here

        menu.add(itemAbrir);
        menu.addSeparator();
        menu.add(itemSair);

        trayIcon = new TrayIcon(icon, "Tooltip", menu);

        try {
            tray.add(trayIcon);
            trayIcon.addMouseListener(new MouseAdapter() {
View Full Code Here

                        Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });
            //Construimos el TrayIcon con la imagen y el popup previamente definidos
            trayIcon = new TrayIcon(imagen, "AgenteTuristico", popup);
            trayIcon.setImageAutoSize(true);
            trayIcon.addMouseListener(new MouseListener() {

                @Override
                public void mouseReleased(MouseEvent arg0) {
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {

    TrayIcon trayIcon = null;
    if (SystemTray.isSupported()) {
      // get the SystemTray instance
      SystemTray tray = SystemTray.getSystemTray();
      // load an image
      Image image = ((ImageIcon) IconFactory.getIconBig("report-80x80.png")).getImage();
      trayIcon = new TrayIcon(image, "Time Reporting", new TrayPopupMenu());
      try {
        tray.add(trayIcon);
      } catch (AWTException e) {
        System.err.println(e);
      }
View Full Code Here

TOP

Related Classes of java.awt.TrayIcon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.