本文整理匯總了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);
}
});
}
}
示例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;
}
}
示例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");
}
}
示例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;
}
示例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;
}