Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-29-2007, 01:11 PM
Member
 
Join Date: Jul 2007
Posts: 2
shapeshifter is on a distinguished road
Minimize to System Tray In Windows
Does anybody know how to make an app to have a "minimize to tray" feature?....
I want to remove the minimized button on the task bar & put it in the system tray so that the app is not mixed with other general stuff.....
Please Help......
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-29-2007, 04:06 PM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Got this code from a friend, this' the translated code in english
Code:
import java.awt.HeadlessException;import java.awt.Image; import java.awt.MenuItem; import java.awt.Panel; import java.awt.PopupMenu; import java.awt.SystemTray; import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import javax.swing.Icon; import javax.swing.JOptionPane; import javax.swing.plaf.metal.MetalIconFactory; public class SysTray { private static Image getImage() throws HeadlessException { Icon defaultIcon = MetalIconFactory.getTreeComputerIcon(); Image img = new BufferedImage(defaultIcon.getIconWidth(), defaultIcon.getIconHeight(), BufferedImage.TYPE_4BYTE_ABGR); defaultIcon.paintIcon(new Panel(), img.getGraphics(), 0, 0); return img; } private static PopupMenu createPopupMenu() throws HeadlessException { PopupMenu menu = new PopupMenu(); MenuItem exit = new MenuItem("Exit"); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); menu.add(exit); return menu; } public static void main(String[] args) throws Exception { TrayIcon icon = new TrayIcon(getImage(), "This is a Java Tray Icon", createPopupMenu()); icon.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Bring Java to the Desktop app"); } }); SystemTray.getSystemTray().add(icon); while(true) { Thread.sleep(10000); icon.displayMessage("Warning", "Click me! =)", TrayIcon.MessageType.WARNING); } } }
Hope this helps
CruxBlack
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-14-2007, 07:24 PM
Member
 
Join Date: Jul 2007
Posts: 2
shapeshifter is on a distinguished road
thanx man.........appreciate it....
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-15-2007, 03:19 AM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Likewise
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Baloon message on a tray icon Eranga AWT / Swing 5 04-10-2008 03:12 PM
swt for windows Gajesh Tripathi SWT / JFace 2 10-18-2007 07:43 AM
First windows application tha_crazy New To Java 1 08-13-2007 04:22 PM
Help with windows in java lenny AWT / Swing 1 08-07-2007 07:22 AM
How to get rid of minimize and close icon on a jdialog? sandor AWT / Swing 1 04-09-2007 01:05 AM


All times are GMT +3. The time now is 06:28 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org