Java Code Examples for java.awt.TrayIcon#setToolTip()

The following examples show how to use java.awt.TrayIcon#setToolTip() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NeembuuUploader.java    From neembuu-uploader with GNU General Public License v3.0 6 votes vote down vote up
private void setUpTrayIcon() {
    if (SystemTray.isSupported()) {
        //trayIcon.setImageAutoSize(true); It renders the icon very poorly.
        //So we render the icon ourselves with smooth settings.
        {
            Dimension d = SystemTray.getSystemTray().getTrayIconSize();
            trayIcon = new TrayIcon(getIconImage().getScaledInstance(d.width, d.height, Image.SCALE_SMOOTH));
        }
        //trayIcon = new TrayIcon(getIconImage());
        //trayIcon.setImageAutoSize(true);
        trayIcon.setToolTip(Translation.T().trayIconToolTip());
        trayIcon.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                NULogger.getLogger().info("System tray double clicked");

                setExtendedState(JFrame.NORMAL);
                setVisible(true);
                repaint();
                SystemTray.getSystemTray().remove(trayIcon);
            }
        });
    }
}
 
Example 2
Source File: UpdatePopupMenu.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void createSystemTrayIcons() {

        final TrayIcon trayIcon = new TrayIcon(createSystemTrayIconImage());
        trayIcon.setImageAutoSize(true);
        trayIcon.setToolTip("Update Popup Menu items");

        try {
            trayIcon.setPopupMenu(createPopupMenu(trayIcon, 2));
            SystemTray.getSystemTray().add(trayIcon);

        } catch (AWTException ex) {
            throw new RuntimeException("System Tray cration failed");
        }
    }
 
Example 3
Source File: AlertMaker.java    From Library-Assistant with Apache License 2.0 5 votes vote down vote up
public static void showTrayMessage(String title, String message) {
    try {
        SystemTray tray = SystemTray.getSystemTray();
        BufferedImage image = ImageIO.read(AlertMaker.class.getResource(LibraryAssistantUtil.ICON_IMAGE_LOC));
        TrayIcon trayIcon = new TrayIcon(image, "Library Assistant");
        trayIcon.setImageAutoSize(true);
        trayIcon.setToolTip("Library Assistant");
        tray.add(trayIcon);
        trayIcon.displayMessage(title, message, MessageType.INFO);
        tray.remove(trayIcon);
    } catch (Exception exp) {
        exp.printStackTrace();
    }
}
 
Example 4
Source File: JSystemTray.java    From PeerWasp with MIT License 5 votes vote down vote up
private TrayIcon create(Image image) throws IOException {
	TrayIcon trayIcon = new java.awt.TrayIcon(image);
	trayIcon.setImageAutoSize(true);
	trayIcon.setToolTip(tooltip);
	trayIcon.setPopupMenu(createMenu(false));
	return trayIcon;
}