Package java.awt

Examples of java.awt.TrayIcon


        mSystemTray = java.awt.SystemTray.getSystemTray();
        boolean isSupported = java.awt.SystemTray.isSupported();
        if(isSupported) {
          try {
            if(new File("imgs/TrayIcon.png").isFile()) {
              mTrayIcon = new TrayIcon(ImageIO.read(new File("imgs/TrayIcon.png")), tooltip);
            }
            else {
              Dimension trayIconSize = getTrayIconSize();
              BufferedImage trayIconImage = null;
              Color backgroundColor = null;

              if(trayIconSize.height > 16 && trayIconSize.height <= 32 && new File("imgs/tvbrowser32.png").isFile()) {
                trayIconImage = UiUtilities.scaleIconToBufferedImage(ImageIO.read(new File("imgs/tvbrowser32.png")),
                    trayIconSize.width, trayIconSize.height, BufferedImage.TYPE_INT_ARGB, backgroundColor);
              }
              else if(trayIconSize.height > 32 && trayIconSize.height <= 48 && new File("imgs/tvbrowser48.png").isFile()) {
                trayIconImage = UiUtilities.scaleIconToBufferedImage(ImageIO.read(new File("imgs/tvbrowser48.png")),
                    trayIconSize.width, trayIconSize.height, BufferedImage.TYPE_INT_ARGB, backgroundColor);
              }
              else if(trayIconSize.height > 48 && new File("imgs/tvbrowser128.png").isFile()) {
                trayIconImage = UiUtilities.scaleIconToBufferedImage(ImageIO.read(new File("imgs/tvbrowser128.png")),
                    trayIconSize.width, trayIconSize.height, BufferedImage.TYPE_INT_ARGB, backgroundColor);
              }
              else {
                trayIconImage = ImageIO.read(new File("imgs/tvbrowser16.png"));
              }

              mTrayIcon = new TrayIcon(trayIconImage, tooltip);
            }
          }catch(Throwable sizeFault) {
            mTrayIcon = new TrayIcon(ImageIO.read(new File("imgs/tvbrowser16.png")), tooltip);
          }

          mTrayParent = new JDialog();
          mTrayParent.setTitle("Tray-Menu");
View Full Code Here


        Main.quit();
      }
    });
    menu.add(item);

    trayIcon = new TrayIcon(icon, "regain", menu);
    trayIcon.setImageAutoSize(true);
    trayIcon.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent evt) {
View Full Code Here

      logger.warn("Could not find icon for system tray");
      return;
    }

    SystemTray tray = SystemTray.getSystemTray();
    trayIcon = new TrayIcon(icon.getImage(), "JHylaFAX", popup);

    ActionListener actionListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        JHylaFAX.getInstance().setVisible(true);
      }
View Full Code Here

    int[] pix = new int[w*w];
    for (int i=0; i< w*w; i++ )
      pix [i]=(int)(Math.random ()*255);
    ImageProducer producer = new MemoryImageSource ( w,w,pix,0,w );
    Image  image = Toolkit.getDefaultToolkit().createImage(producer);
    TrayIcon trayIcon = new TrayIcon(image);
    trayIcon.setImageAutoSize(true);
    startWindow();
    try
    {
      tray.add(trayIcon);
      System.out.println("installed tray");
View Full Code Here

    InputStream f = null;
    try
    {
      f = getImage(icon);
      ti = new TrayIcon(createColorImage(f, null, null));
      ti.setImageAutoSize(true);

      Dimension d = ti.getSize();
      f = getImage(icon);
      iconRunning = createColorImage(f, Color.GREEN, d);
      f = getImage(icon);
      iconIdle = createColorImage(f, Color.RED, d);
      f = getImage(icon);
      iconElse = createColorImage(f, Color.ORANGE, d);
      f = getImage(icon);
      iconOffline = createColorImage(f, Color.BLACK, d);
    }
    catch (Exception ex)
    {
      System.out.println("System Tray: file type not supported -> abort");
      return;
    }

    ti = new TrayIcon(iconIdle);
    /*
     * process.addStateChangeListener(new StateChangeListener() { public
     * void stateChange(int newState, int oldState) { if (newState ==
     * WrappedProcess.STATE_SHUTDOWN) { synchronized (tray) {
     * tray.remove(ti); }
View Full Code Here

   * Creates the SystemTrayIcon, if configured to do so.
   */
  void configureTrayIcon() {
    if (Pooka.getProperty("Pooka.trayIcon.enabled", "true").equalsIgnoreCase("true")) {
      try {
        mTrayIcon = new TrayIcon(mStandardTrayIcon.getImage());
        mTrayIcon.setImageAutoSize(true);
        //mTrayIcon.setTimeout(5000);

        mTrayIcon.setPopupMenu(createPopupMenu());
        mTrayIcon.addActionListener(new AbstractAction() {
View Full Code Here

    MenuItem openItem = new MenuItem("Open");
    MenuItem exitItem = new MenuItem("Exit");
    popup.add(openItem);
    popup.add(exitItem);

    final TrayIcon trayIcon = new TrayIcon(IconHelper.getProductLogoImage(), "double click here to open Dot Project Client", popup);
    final SystemTray tray = SystemTray.getSystemTray();
    trayIcon.setImageAutoSize(true);

    trayIcon.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        frm.setVisible(true);
        frm.setExtendedState(JFrame.MAXIMIZED_BOTH);
        tray.remove(trayIcon);
      }
    });
    ActionListener exitListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.out.println("Exiting...");
        tray.remove(trayIcon);
        System.exit(0);
      }
    };
    exitItem.addActionListener(exitListener);
    ActionListener openListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        frm.setVisible(true);
        frm.setExtendedState(JFrame.MAXIMIZED_BOTH);
        tray.remove(trayIcon);
      }
    };
    openItem.addActionListener(openListener);
   
    frm.addWindowListener(new WindowAdapter() {
      @Override
      public void windowIconified(WindowEvent e) {

        try {
          tray.add(trayIcon);
          frm.setVisible(false);
          trayIcon.displayMessage("Dot Project", "You can access Dot Project by double clicking this icon", TrayIcon.MessageType.INFO);
        } catch (AWTException ex) {
          System.err.println("TrayIcon could not be added.");
        }
      }
    });
View Full Code Here

    item = new MenuItem("Exit Harlequin");
    item.addActionListener(listener);
    popup.add(item);

    baseimage = Images.getImage("/images/harlequin.png");
    trayicon = new TrayIcon(baseimage, Configuration.properties.getProperty("client.title"),
        popup);

    trayicon.setImageAutoSize(true);
    trayicon.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e)
View Full Code Here

        }
      });
      pm.add(mi);
    }

    tray = new TrayIcon(image);
    tray.setPopupMenu(pm);
    if(OperatingSystem.userOS != OperatingSystem.OSX)
      tray.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
View Full Code Here

        growl.notifyGrowlOf(gt, headline, text);
      } catch (Exception e) {
        Out.exception(e);
      }
    } else {
      TrayIcon tray = GuiDesktop.getTray();
      if(tray != null)
        tray.displayMessage(headline, text, TrayIcon.MessageType.INFO);
    }
  }
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.