1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Created by root on 23.05.2016. */ public class Main { public static void main(String[] args) throws AWTException { PopupMenu popup = new PopupMenu(); MenuItem exitItem = new MenuItem("Выход"); exitItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }); popup.add(exitItem); SystemTray systemTray = SystemTray.getSystemTray(); Image image = Toolkit.getDefaultToolkit().getImage("https://hysterical.ru/wp-content/uploads/2016/05/vk_icon.png"); TrayIcon trayIcon = new TrayIcon(image, "VKApi", popup); trayIcon.setImageAutoSize(true); systemTray.add(trayIcon); trayIcon.displayMessage("VKApi", "text", TrayIcon.MessageType.INFO); // System.exit(0); } } |