本文整理了Java中java.awt.TrayIcon.addActionListener()
方法的一些代码示例,展示了TrayIcon.addActionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TrayIcon.addActionListener()
方法的具体详情如下:
包路径:java.awt.TrayIcon
类名称:TrayIcon
方法名:addActionListener
暂无
代码示例来源:origin: igniterealtime/Openfire
trayIcon.addActionListener(actionListener);
trayIcon.addMouseListener(new MouseListener() {
@Override
代码示例来源:origin: stackoverflow.com
trayIcon.addActionListener(listener);
代码示例来源:origin: stackoverflow.com
trayIcon.addActionListener(showListener);
代码示例来源:origin: stackoverflow.com
public class Main {
static Image image = Toolkit.getDefaultToolkit().getImage("images/tray.gif");
static TrayIcon trayIcon = new TrayIcon(image, "Tester2");
public static void main(String[] a) throws Exception {
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
trayIcon.setImageAutoSize(true);
trayIcon.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("In here");
trayIcon.displayMessage("Tester!", "Some action performed", TrayIcon.MessageType.INFO);
}
});
try {
tray.add(trayIcon);
} catch (AWTException e) {
System.err.println("TrayIcon could not be added.");
}
}
}
}
代码示例来源:origin: Nilhcem/FakeSMTP
try {
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
代码示例来源:origin: stackoverflow.com
trayIcon.addActionListener(actionListener);
try {
tray.add(trayIcon);
代码示例来源:origin: stackoverflow.com
trayIcon.addActionListener(new ActionListener() {
代码示例来源:origin: chatty/chatty
/**
* Adds an ActionListener to the tray icon and the tray popoup menu. Does
* nothing if the tray is not available.
*
* @param listener The ActionListener to add to the icon and menu
*/
public void addActionListener(ActionListener listener) {
if (trayIcon != null) {
trayIcon.addActionListener(listener);
popup.addActionListener(listener);
}
}
代码示例来源:origin: magefree/mage
trayIcon.setImageAutoSize(true);
trayIcon.addActionListener(e -> {
stopBlink();
MageFrame frame = MageFrame.getInstance();
代码示例来源:origin: stackoverflow.com
trayIcon.addActionListener(action);
SystemTray.getSystemTray().add(trayIcon);
代码示例来源:origin: de.alpharogroup/swing-components
/**
* Factory method for create a {@link TrayIcon} object.
*
* @param imgFilename
* the img filename
* @param appName
* the app name
* @param systemTrayPopupMenu
* the system tray popup menu
* @param actionListeners
* the action listeners
* @return the new {@link TrayIcon}.
*/
public static TrayIcon newTrayIcon(final String imgFilename, final String appName,
final PopupMenu systemTrayPopupMenu, final Map<String, ActionListener> actionListeners)
{
final Image image = Toolkit.getDefaultToolkit().getImage(imgFilename);
final TrayIcon trayIcon = new TrayIcon(image, appName, systemTrayPopupMenu);
for (final Map.Entry<String, ActionListener> actionListener : actionListeners.entrySet())
{
trayIcon.setActionCommand(actionListener.getKey());
trayIcon.addActionListener(actionListener.getValue());
}
return 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: stackoverflow.com
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class AWTScratch {
public static void main(String[] args) {
BufferedImage im = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB);
TrayIcon ti = new TrayIcon(im, "Multiline\nmulti");
ti.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
ti.setImageAutoSize(true);
if (SystemTray.isSupported()){
SystemTray st=SystemTray.getSystemTray();
try {
st.add(ti);
} catch (AWTException e1) {
e1.printStackTrace();
}
}
}
}
代码示例来源:origin: stackoverflow.com
trayIcon.addActionListener(listener);
代码示例来源:origin: stackoverflow.com
trayIcon.addActionListener(actionListener);
trayIcon.addMouseListener(mouseListener);
代码示例来源:origin: stackoverflow.com
Image im = Toolkit.getDefaultToolkit().getImage("c:\\icons\\icon1.png");
final TrayIcon tri = new TrayIcon(im);
tri.addActionListener(new ActionListener() {
代码示例来源:origin: IanDarwin/javasrc
trayIcon.addActionListener(actionListener);
代码示例来源:origin: icza/scelight
trayIcon.addActionListener( Actions.SHOW_MAIN_FRAME );
代码示例来源:origin: SKCraft/Launcher
trayIcon.setToolTip(SharedLocale.tr("console.trayTooltip"));
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
代码示例来源:origin: SKCraft/SKMCLauncher
trayIcon.setToolTip(_("processConsole.tray.toolTip"));
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
内容来源于网络,如有侵权,请联系作者删除!