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


Java SystemTray.getTrayIcons方法代碼示例

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


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

示例1: init

import java.awt.SystemTray; //導入方法依賴的package包/類
/**
 * Initializes the tray
 */
public void init() {

	if (SystemTray.isSupported()) {

		SystemTray tray = SystemTray.getSystemTray();

		if (tray.getTrayIcons().length == 0) {

			String iconFileName = resources.getImagePath() + File.separator
					+ "MidiAutomatorIcon16.png";
			image = Toolkit.getDefaultToolkit().getImage(iconFileName);
			trayPopupMenu.init();
			trayIcon = new TrayIcon(image, NAME);
			trayIcon.addMouseListener(trayMouseListener);

			try {
				tray.add(trayIcon);
			} catch (AWTException e) {
				log.error("Error on adding tray icon.", e);
			}
		}
	}
}
 
開發者ID:aguelle,項目名稱:MIDI-Automator,代碼行數:27,代碼來源:Tray.java

示例2: setTray

import java.awt.SystemTray; //導入方法依賴的package包/類
void setTray() {
    if (!Config.getInstance().getBoolean(Config.MAIN_TRAY)) {
        this.removeTray();
        return;
    }

    if (!SystemTray.isSupported()) {
        LOGGER.info("tray icon not supported");
        return;
    }

    if (mTrayIcon == null)
        mTrayIcon = this.createTrayIcon();

    SystemTray tray = SystemTray.getSystemTray();
    if (tray.getTrayIcons().length > 0)
        return;

    try {
        tray.add(mTrayIcon);
    } catch (AWTException ex) {
        LOGGER.log(Level.WARNING, "can't add tray icon", ex);
    }
}
 
開發者ID:kontalk,項目名稱:desktopclient-java,代碼行數:25,代碼來源:TrayManager.java

示例3: stopNotify

import java.awt.SystemTray; //導入方法依賴的package包/類
@Override
public final void stopNotify() {
	if (SystemTray.isSupported() && started) {
		started = false;
		final SystemTray tray = SystemTray.getSystemTray();
		try {
			for (TrayIcon trayIcon : tray.getTrayIcons()) {
				tray.remove(trayIcon);
			}
			tray.add(passive);
		} catch (AWTException e) {
			
		}
	}
}
 
開發者ID:GoldenGnu,項目名稱:jwarframe,代碼行數:16,代碼來源:TrayTool.java

示例4: startNotify

import java.awt.SystemTray; //導入方法依賴的package包/類
@Override
public void startNotify(final int count, final NotifySource source, final Set<String> categories) {
	if (SystemTray.isSupported() && !started) {
		started = true;
		final SystemTray tray = SystemTray.getSystemTray();
		try {
			for (TrayIcon trayIcon : tray.getTrayIcons()) {
				tray.remove(trayIcon);
			}
			tray.add(active);
		} catch (AWTException e) {
			
		}
	}
}
 
開發者ID:GoldenGnu,項目名稱:jwarframe,代碼行數:16,代碼來源:TrayTool.java


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