Results 1 to 2 of 2
Thread: minimize button and system tray
- 12-10-2009, 12:18 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 3
- Rep Power
- 0
minimize button and system tray
Hello
When i push the minimize button i would like to do a
but the question is, where do i write this?Java Code:myFrame.setState ( Frame.ICONIFIED );
also, i would like my application the go to system tray:
but when i put the method in the main method, is says:Java Code:public void systemTray() { if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); Image image = Toolkit.getDefaultToolkit().getImage("sdu.gif"); ActionListener exitListener = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Exiting..."); System.exit(0); } }; PopupMenu popup = new PopupMenu(); MenuItem defaultItem = new MenuItem("Exit"); defaultItem.addActionListener(exitListener); popup.add(defaultItem); trayIcon = new TrayIcon(image, "Tray Demo", popup); trayIcon.setImageAutoSize(true); try { tray.add(trayIcon); } catch (AWTException e) { System.err.println("TrayIcon could not be added."); } } }
non-static method systemTray() cannot be referenced from a static contex
How do i fix this? thanks! :)
- 12-10-2009, 03:31 AM #2
Similar Threads
-
how to disable minimize and maximize button in jframe window
By santhosh_el in forum AWT / SwingReplies: 6Last Post: 11-22-2010, 11:55 AM -
Minimize to System Tray In Windows
By shapeshifter in forum AWT / SwingReplies: 4Last Post: 12-07-2008, 01:42 PM -
System Tray Message tracking.
By Hichhiker in forum AWT / SwingReplies: 2Last Post: 10-11-2008, 03:58 AM -
Placing an icon with a popup menu on the system tray
By Java Tip in forum SWTReplies: 0Last Post: 07-25-2008, 02:32 PM -
System Tray
By JavaLerner in forum New To JavaReplies: 2Last Post: 07-13-2008, 08:25 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks