本文整理了Java中java.awt.TrayIcon.<init>()
方法的一些代码示例,展示了TrayIcon.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TrayIcon.<init>()
方法的具体详情如下:
包路径:java.awt.TrayIcon
类名称:TrayIcon
方法名:<init>
暂无
代码示例来源:origin: stackoverflow.com
java.awt.SystemTray.getSystemTray().add(new java.awt.TrayIcon(java.awt.Toolkit.getDefaultToolkit().getImage("foo.png")));
代码示例来源:origin: runelite/runelite
final TrayIcon trayIcon = new TrayIcon(icon, title);
trayIcon.setImageAutoSize(true);
代码示例来源:origin: igniterealtime/Openfire
trayIcon = new TrayIcon(offIcon.getImage(), appName, menu);
trayIcon.setImageAutoSize(true);
trayIcon.addActionListener(actionListener);
代码示例来源:origin: RipMeApp/ripme
try {
mainIcon = ImageIO.read(getClass().getClassLoader().getResource("icon.png"));
trayIcon = new TrayIcon(mainIcon);
trayIcon.setToolTip(mainFrame.getTitle());
trayIcon.setImageAutoSize(true);
代码示例来源:origin: stackoverflow.com
trayIcon=new TrayIcon(image, "SystemTray Demo", popup);
trayIcon.setImageAutoSize(true);
}else{
代码示例来源:origin: stackoverflow.com
trayIcon = new TrayIcon(image, "Title", popup);
代码示例来源:origin: Nilhcem/FakeSMTP
/**
* @param mainFrame The MainFrame class used for closing actions from TrayPopup.
*/
public MainWindowListener(final MainFrame mainFrame) {
useTray = (SystemTray.isSupported() && Boolean.parseBoolean(Configuration.INSTANCE.get("application.tray.use")));
if (useTray) {
final TrayPopup trayPopup = new TrayPopup(mainFrame);
final Image iconImage = Toolkit.getDefaultToolkit().getImage(getClass().
getResource(Configuration.INSTANCE.get("application.icon.path")));
trayIcon = new TrayIcon(iconImage);
trayIcon.setImageAutoSize(true);
trayIcon.setPopupMenu(trayPopup.get());
}
}
代码示例来源:origin: i2p/i2p.i2p
private TrayIcon getAWTTrayIcon(String tooltip) throws AWTException {
PopupMenu menu = getMainMenu();
if (!SystemVersion.isWindows())
menu.setFont(new Font("Arial", Font.BOLD, 14));
TrayIcon ti = new TrayIcon(getTrayImage(), tooltip, menu);
ti.addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent m) {}
public void mouseEntered(MouseEvent m) {}
public void mouseExited(MouseEvent m) {}
public void mousePressed(MouseEvent m) { updateMenu(); }
public void mouseReleased(MouseEvent m) { updateMenu(); }
});
return ti;
}
代码示例来源:origin: stackoverflow.com
PopupMenu popup = new PopupMenu();
MenuItem item = new MenuItem("Hello, World");
trayIcon = new TrayIcon(image, "Tip Text", popup);
ActionListener menuActionListener = new ActionListener() {
代码示例来源:origin: tomighty/tomighty
@PostConstruct
public void initialize() {
bus.subscribe(new UpdateTimeOnTray(), TimerTick.class);
bus.subscribe(new ShowTomatoIconWhenTimerStops(), TimerStopped.class);
bus.subscribe(new RemoveTimeFromTray(), TimeOnTrayConfigChanged.class);
trayIcon = new TrayIcon(icons.tomato());
trayIcon.addMouseListener(new TrayListener());
trayIcon.setImageAutoSize(true);
}
代码示例来源:origin: i2p/i2p.i2p
menu.setFocusable(true);
frame.add(menu);
TrayIcon ti = new TrayIcon(getTrayImage(), tooltip, null);
ti.addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent e) {}
代码示例来源:origin: stackoverflow.com
TrayIcon trayIcon = new TrayIcon(image, "SystemTray Demo", trayPopupMenu);
代码示例来源:origin: stackoverflow.com
Image image = Toolkit.getDefaultToolkit().getImage("gifIcon.gif");
PopupMenu popup = new PopupMenu();
final TrayIcon trayIcon = new TrayIcon(image, "The Tip Text", popup);
MenuItem item = new MenuItem("Error");
item.addActionListener(new ShowMessageListener(trayIcon, "Error Title", "Error", TrayIcon.MessageType.ERROR));
代码示例来源:origin: stackoverflow.com
return;
final TrayIcon trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().getImage(
new URL("http://home.comcast.net/~supportcd/Icons/Java_Required.jpg")), "Library Drop");
final SystemTray tray = SystemTray.getSystemTray();
代码示例来源:origin: trekawek/radioblock
private static Image getIcon(String name) {
try {
BufferedImage trayIconImage = ImageIO.read(PlayerController.class.getResource("/" + name));
int trayIconWidth = new TrayIcon(trayIconImage).getSize().width;
return trayIconImage.getScaledInstance(trayIconWidth, -1, Image.SCALE_SMOOTH);
} catch(IOException e) {
throw new UncheckedIOException(e);
}
}
代码示例来源:origin: magefree/mage
mainImage = ImageManagerImpl.instance.getAppSmallImage();
flashedImage = ImageManagerImpl.instance.getAppFlashedImage();
trayIcon = new TrayIcon(mainImage);
trayIcon.setImageAutoSize(true);
代码示例来源:origin: stackoverflow.com
SystemTray tray = SystemTray.getSystemTray();
TrayIcon icon = new TrayIcon(....);
icon.setToolTip("I have finished my work");
icon.setActionListener(this);
tray.add(trayIcon);
代码示例来源:origin: stackoverflow.com
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed( ActionEvent e ) {
//Double click code here
}
};
SystemTray tray = SystemTray.getSystemTray();
TrayIcon trayIcon = new TrayIcon(<icon stuff>);
trayIcon.addActionListener(actionListener);
tray.add(trayIcon);
代码示例来源:origin: scruel/ClipIt
private static void addTray(GlobalHotkeyListener hotkeyListener) throws AWTException {
ImageIcon imageIcon = new ImageIcon(Objects.requireNonNull(TipsFrame.class.getClassLoader().getResource("ClipIt.png")));
TrayIcon trayIcon = new TrayIcon(imageIcon.getImage());
trayIcon.setToolTip("ClipIt");
PopupMenu popupMenu = new PopupMenu();
MenuItem exitMenuItem = new MenuItem("Exit");
exitMenuItem.addActionListener(actionEvent -> hotkeyListener.destroy());
popupMenu.add(exitMenuItem);
trayIcon.setPopupMenu(popupMenu);
SystemTray systemTray = SystemTray.getSystemTray();
systemTray.add(trayIcon);
}
代码示例来源:origin: Slowpoke101/FTBLaunch
public static void setUpSystemTray () {
trayMenu = new TrayMenu();
SystemTray tray = SystemTray.getSystemTray();
TrayIcon trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().getImage(instance.getClass().getResource("/image/logo_ftb.png")));
trayIcon.setPopupMenu(trayMenu);
trayIcon.setToolTip(Constants.name);
trayIcon.setImageAutoSize(true);
try {
tray.add(trayIcon);
} catch (AWTException e) {
e.printStackTrace();
}
}
内容来源于网络,如有侵权,请联系作者删除!