當前位置: 首頁>>代碼示例>>Java>>正文


Java TrayIcon.setToolTip方法代碼示例

本文整理匯總了Java中java.awt.TrayIcon.setToolTip方法的典型用法代碼示例。如果您正苦於以下問題:Java TrayIcon.setToolTip方法的具體用法?Java TrayIcon.setToolTip怎麽用?Java TrayIcon.setToolTip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.TrayIcon的用法示例。


在下文中一共展示了TrayIcon.setToolTip方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUpTrayIcon

import java.awt.TrayIcon; //導入方法依賴的package包/類
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);
            }
        });
    }
}
 
開發者ID:Neembuu-Uploader,項目名稱:neembuu-uploader,代碼行數:26,代碼來源:NeembuuUploader.java

示例2: create

import java.awt.TrayIcon; //導入方法依賴的package包/類
public static boolean create()
{
	menu = new Menu();
	try
	{
		icon = new TrayIcon(Constants.TRAY_ICON, "UploadR", menu);
		icon.addMouseListener(menu.getItemHandler());
		SystemTray.getSystemTray().add(icon);
		icon.setToolTip("UploadR");
		return true;
	}
	catch(AWTException e)
	{
		return false;
	}
}
 
開發者ID:Hual,項目名稱:UploadR,代碼行數:17,代碼來源:MenuTrayIcon.java

示例3: createSystemTrayIcons

import java.awt.TrayIcon; //導入方法依賴的package包/類
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");
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:UpdatePopupMenu.java

示例4: initSystemTray

import java.awt.TrayIcon; //導入方法依賴的package包/類
/**
 * This method inits the system tray. if supported, the program's window
 * does not deiconfy/minimize to the taskbar, but hides and displays an icon
 * in the system tray instead.
 */
private void initSystemTray() {
    // if systemtray is not supported, leave method
    if (!SystemTray.isSupported()) {
        return;
    }
    // create tray-icon with tooltip
    trayIcon = new TrayIcon((new ImageIcon(org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class).getClass().getResource("/de/danielluedecke/zettelkasten/resources/icons/zkn3_16x16.png"), "Zettelkasten")).getImage());
    // retrieve system tray
    tray = SystemTray.getSystemTray();
    // try to add the tray icon to the systray
    try {
        tray.add(trayIcon);
    } catch (AWTException e) {
        Constants.zknlogger.log(Level.WARNING, "Tray Icon could not be added.");
        return;
    }
    // if tray icon was successfully added, add tooltip
    trayIcon.setToolTip("Zettelkasten");
    // and mouse listener, so the window will be restored when the user clicks on the tray icon
    trayIcon.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            // set main frame visible
            getFrame().setVisible(true);
            // restore frame state to normal state
            getFrame().setExtendedState(java.awt.Frame.NORMAL);
            // if we have a tray icon, remove it
            if (tray != null) {
                // clear popup menu
                trayIcon.setPopupMenu(null);
                // remove tray icon
                tray.remove(trayIcon);
            }
            // and say that tray icon is currently not installed
            trayIconInstalled = false;
        }
    });
    trayIconInstalled = true;
}
 
開發者ID:sjPlot,項目名稱:Zettelkasten,代碼行數:45,代碼來源:ZettelkastenView.java

示例5: create

import java.awt.TrayIcon; //導入方法依賴的package包/類
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;
}
 
開發者ID:PeerWasp,項目名稱:PeerWasp,代碼行數:8,代碼來源:JSystemTray.java


注:本文中的java.awt.TrayIcon.setToolTip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。