System Tray application

I am using the Java 6 feature for creating System Tray capable applications.
I have used the SystemTray.java example from Sun and this works fine.
What I need to know is how I hide the application in the Task Bar. The user would then need to click the System Tray icon, for the application, to bring the application back up again.
I look forward to someones help.

Here's what would you do in your application:
to make it disappear on minimize:
          applicationFrame.addWindowListener (new WindowAdapter () {
               public void windowIconified (WindowEvent e) {
                    setVisible (false);
          });and a mouse listener to your TrayIcon to show it again on left click:
               trayIcon.addMouseListener (new MouseAdapter () {
                    public void mouseClicked (MouseEvent e) {
                         if (e.getButton () == e.BUTTON1)
                              applicationFrame.setVisible (true);
               });And I'd suggest you to take a look here about window listeners
http://java.sun.com/docs/books/tutorial/uiswing/events/windowlistener.html

Similar Messages

  • Why my system tray application terminates when JFrame is closed???

    Hi,
    I am using JDK 1.6 with Netbeans 5.5 and currently trying to make an system tray application. I have one main class which runs as a system tray application and one JFrame class which will be shown when user selects a menu item from system tray. So far so good but a small problem. When the JFrame form is closed, my system tray application also closes. Can somebody tell me what am I missing?
    Thanks

    set the DefaultCloseOperation of the JFrame to DISPOSE_ON_CLOSE instead of EXIT_ON_CLOSE
    db

  • System Tray Program doesn't show a form from the menu

    public SysTrayApp()
    ContextMenu TrayMenu = new ContextMenu();
    TrayMenu.MenuItems.Add("Exit", OnExit);
    TrayMenu.MenuItems.Add("Send Mail", SendMail);
    TrayMenu.MenuItems.Add("Add Exception", AddException);
    TrayIcon.Icon = new Icon(SystemIcons.Application, 40, 40);
    TrayIcon.Text = "RJC Server Services";
    TrayIcon.ContextMenu = TrayMenu;
    TrayIcon.Visible = true;
    NewTimer = new System.Timers.Timer(5 * 60 * 1000);
    NewTimer.Elapsed += NewTimer_Elapsed;
    NewTimer.Start();
    void AddException(Object sender, EventArgs e)
    ExceptionList ExceptionForm = new ExceptionList();
    ExceptionForm.ShowDialog();
    This is the code I am trying to use to show a instance of the Exception form. My application is a system tray application, when right clicked it shows menu items, however clicking the add exception menu item doesn't show the form? I have also tried ExceptionForm.Show()
    to no avail. Any ideas?

    figured it out: ExceptionForm.Visible = true;
    Also I had a long running process on form load that took a while to execute before the form was shown.

  • Running a forms application from the system tray

    I have a forms application.I want to run it from the system tray ,just like how norton antivirus or yahoo messenger works .How do i do it .Pls help

    You can create Actice EXE or OCX that enables your application to hide in system tray and embed it in your Forms6i Application.

  • How to make the application run in System tray?

    Hi Javamates,
    I have a Swing application. I want my application to reside in the Windows System tray when the application is minimised , and also be restored when it is clicked in the tray . How do i do this ?
    Dinesh

    Pls... do search the forum before posting.. !!
    U can hav a look at this..
    http://forum.java.sun.com/thread.jspa?forumID=257&threadID=177333

  • How to remove Application icon from system tray on uninstalling the application

    Hello Friends
                        Is there any way to remove a system tray icon when i unistalled the application?
    i am making a desktop application but i am facing a problem that during uninstallation of that application it remains on the system tray.So can any body guide me any event which fire on unistallaion of application so that i can remove the application manually using cllosing event.please help me out from this poblem i am totally confused.
    Thanks and Regards
       Vineet Osho

    I have same problem with you but I haven't find an answer for that. Did you have your answer for the problem?
    Thanks!

  • Application Explorer - Not Loading To System Tray On Login

    Hi,
    We are getting users logging into their computers in the morning, and finding that the Novell Application Explorer is not loading into the Windows system tray.
    Manually running the program does not work, only a reboot seems to cure the issue. Any thoughts?
    7.0.173.90519 - ZENworks Desktop Management 7 SP1 Interim Release 4

    No idea why, but you may want to try ...
    Killing Explorer.exe and then Trying to Run the NAL Explorer.
    NAL Explorer hooks into Explorer.exe in a fashion that a hook remains
    even after killing NAL Explorer.
    This hook may be having an issue so NAL Explorer can't start or restart
    properly until Explorer.exe is restarted.
    Again, not a fix, but may be quicker than a reboot if it helps.
    On 11/4/2010 2:36 PM, rhowelld wrote:
    >
    > Hi,
    >
    > We are getting users logging into their computers in the morning, and
    > finding that the Novell Application Explorer is not loading into the
    > Windows system tray.
    >
    > Manually running the program does not work, only a reboot seems to cure
    > the issue. Any thoughts?
    >
    >
    >
    > 7.0.173.90519 - ZENworks Desktop Management 7 SP1 Interim Release 4
    >
    >
    Craig Wilson - MCNE, MCSE, CCNA
    Novell Knowledge Partner
    Novell does not officially monitor these forums.
    Suggestions/Opinions/Statements made by me are solely my own.
    These thoughts may not be shared by either Novell or any rational human.

  • How to put Java application in the MS. Windows System tray

    dear all,
    Is it possible to make a Java application communicate with the MS. Explorer and to put a Java application in the MS. Windows System tray
    Regards

    http://www.esus.com/docs/GetQuestionPage.jsp?uid=624
    or look for madcap on sourceforge

  • Support system tray icon of Air application

    Hi All,
    I developed a widget with flash builder 4 and I exported all the project in AIR application. Then, I packaged AIR application in .exe file for Windows, and dmg file for MAC. My application works correctly for both of OS.
    When I launch application on OS Windows, an image on system tray (for my application a socceer ball) appears. On the other side, on OS MAC my icon appears, but after 3 or 4 seconds it disappears and it is replaced with an other icon (probably it's a default icon of mac for this kind of application?) ...
    What can I do? Thanks in advance, regards
    Gianni

    I attached files reporting images of icon on system tray. I didn't set any option on app descriptor, I used SystemTrayIcon and DockIcon APIs.
    Anyway I attach part of my application code ...
    windowComplete event of WindowedApplication is handled by function preInit () ...
                private function onWindowActivate():void
                    if (!this.windowActivateRequest)
                        this.dock();
                private function onInvoke( event:InvokeEvent ):void
                    if( event.reason == InvokeEventReason.LOGIN )
                        //do background processing...
                        trace( "Running in background..." );
                        this.windowActivateRequest = false;
                        this.dock();                   
                    else
                        trace("Running on screen");
                        this.windowActivateRequest = true;
                        if (this.stage != null)
                            this.stage.nativeWindow.activate();   
                public function dock(event:Event = null):void
                    stage.nativeWindow.visible = false;
                    var imgObj:BitmapAsset = new trayIcon() as BitmapAsset;
                    var bitmampDataTmp:BitmapData = imgObj.bitmapData;
                    var arrayTmp:Array = new Array();
                    arrayTmp.push(bitmampDataTmp);
                    NativeApplication.nativeApplication.icon.bitmaps = arrayTmp;
                public function undock(event:Event = null):void
                    this.windowActivateRequest = true;
                    stage.nativeWindow.visible = true;
                    NativeApplication.nativeApplication.icon.bitmaps = [];
                private function preInit():void
                    try
                        NativeApplication.nativeApplication.startAtLogin = true;
                    catch ( e:Error )
                        trace( "Cannot set startAtLogin:" + e.message );
                    NativeApplication.nativeApplication.addEventListener( InvokeEvent.INVOKE, onInvoke );
                    if(NativeApplication.supportsDockIcon)
                        var dockIcon:DockIcon = NativeApplication.nativeApplication.icon as DockIcon;
                        NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE,undock);
                        dockIcon.menu = createIconMenu();
                    }else{
                        if (NativeApplication.supportsSystemTrayIcon){
                            var sysTrayIcon:SystemTrayIcon = NativeApplication.nativeApplication.icon as SystemTrayIcon;
                            sysTrayIcon.tooltip = "Stopwatch";
                            sysTrayIcon.addEventListener(MouseEvent.CLICK,undock);
                            sysTrayIcon.menu = createIconMenu();   
                private function createIconMenu():NativeMenu
                    var iconMenu:NativeMenu = new NativeMenu();
                    var exitCommand: NativeMenuItem = iconMenu.addItem(new NativeMenuItem("Esci"));
                    exitCommand.addEventListener(Event.SELECT, chiudi);
                    return iconMenu;
    trayIcon is name of .png which represent ball image ...  
    I try to summarize ...In MAC OS DockIcon isn' t represented by ball image ...In Windows OS everything works.
    I'm sorry for disturbing you but I hope that everything is clear.
    Thanks

  • Hiding Application To System Tray will cause Modal dialog unblock

    I have a JFrame, when I minimize it, it will hide. The user can recall it back by simply double click on its icon, which is created in system tray during application initialization.
    However, I am facing problem when I pop up a modal dialog box. (In Linux)
    When I pop up a modal dialog box, I am expecting setVisible(true) will always being block, until the modal dialog box is closed.
    However, in Linux, user is able to minimize the parent windows, even there is a modal dialog box. During minimization, I have to call JFrame.setVisible(false), in order to hide the application.
    A side effect of calling setVisible(false) for a modal dialog box owner (JFrame), will cause the modal dialog box JDialog.setVisible(true) being unblocked and continue for the next statement.
    How I can prevent this, to ensure the JDialog.setVisible is always blocked, until the JDialog is really closed? Thanks!

    tnx Sarcommand ..i give up on that, i understand the risk if that feature is included..
    all i wanted is to make an internet cafe client/server that blocks the client's pc interaction if log time is reached.blocking only the keyboard and mouse.
    i have seen so many softwares sets the cursor position within the dialog bounding box only with user and password there. though my other application runs the mouse is still captured on the dialog even the dialog lost focus.
    if that would not be possible I'll just send notification to the client, a dialog that does not block any application.
    now, im going to try if the client can do som action whenever the server sends alert if the client java app is not the focus. i will post next time what hapens.but if you tried already, if u dont mind posting it so others could know it also..
    tnx so much Sarcommand..

  • Minimizing LabVIEW application to system tray or running it as a Windows process

    Hi guys,
    Is there a way I can minimize a LabVIEW application to the system tray on the right bottom corner of the screen ? My application will run all the time and all I want is a pop-up when errors or information/reports have to be displayed. I have searched exhaustively and now am posting this question. Please let me know if this can be done.
    also, Can a LabVIEW application run as a Windows process? Like it starts up automatically on booting the system?
    Thanks!
    V
    I may not be perfect, but I'm all I got!

    If you search for System Tray you'll find lots of people trying to do the same thing and a few places with example code to get it working.  But the best method I've seen is actually on the Lava forums.
    http://lavag.org/topic/14060-put-your-labview-in-the-tray-once-and-for-all/page__p__86042__hl__+syst...
    As for starting a application on startup.  Again I expect searching you'll find alot of people saying the easiest way is to create a shortcut to your application, then place the shortcut in the Startup folder in your start menu.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Minimize AIR Applications to System Tray.

    Hello. Is there any way to minimize our AIR applications to the system tray? Like Internet Download Manager can have it's window closed but still running and appearing in the system tray, and is there also any way to display balloon messages like some programs do? Any one solution would even be really helpful.
    Thank you.

    Working with the dock and the system tray | Adobe Developer Connection

  • KDE 4.8.0 upgrade - application icons not showing in system tray

    I updated to KDE 4.8.0 through pacman yesterday, and I noticed that system tray is not working as it should. Icons for some applications do not show, while other work OK.
    For example, Akregator icon appers in tray, while icons for Skype, AppSet or the Java application I'm developing do not. I notced that notification ballons for these apps pop up at upper left corner, instead of lower right.
    Anybody got some idea what might be wrong? Maybe QT version issues?
    One more question: how can I bring up these application windows when they do not show in tray?

    When you click on the arrow do they show up in the list ? that list is for hidden apps, if they are right click configure and see here http://userbase.kde.org/images.userbase … ings-2.png

  • Equium A60-191: What application controls battery status in system tray?

    I have had to re-install XP. This caused the loss of the drivers and quite probably other stuff I don't know about.
    One of the items missing seems to be the software or driver? for the battery. The battery no longer charges up to full power. The software that set in the system tray used to indicate the power status and whether it was ac or dc connected.
    Any suggestions what I need and where I can get it from to fix this problem, please?

    Hi
    In my knowledge you dont need any drivers or software to charge the battery to full power. Only what you need is the Toshiba Power saver utility.
    This utility is very useful because you can configure the different power modes for a different notebook usage. For example if you have disconnect the AC adaptor from the notebook the Power saver will automatically switch to the power mode which was configured for the battery usage.
    Such modes help to take care of battery and increases the battery life time and it shows a battery status in the task bar
    But it has nothing to do witch the battery charging.
    In my user manual I have found many info about the battery and how to handle the battery usage. I think the same information you will find in your user manual. Check it.
    The last possibility could be a battery malfunction.
    But in such case only a battery replacement will solve your issue.
    If you want you can try to check if the same happens with the new battery.

  • Satellite L300- 1AQ - Bluetooth tray application has stopped working

    When i put my laptop on it comes up with an error which says:
    *bluetooth tray application has stopped working*
    A problem caused the problem to stop working correctly.
    Windows will close the program and notify you if a solution is available.
    Anyone got a solution?
    The laptop is a Satellite L300- 1AQ
    Only had it a month!!
    Please help, thankyou
    xx

    Hi
    Did you try to reinstall the Toshiba BT stack?
    Usually this should help to get rid of this error message.
    Here you can download the newest BT stack:
    http://aps2.toshiba-tro.de/bluetooth/
    Remove firstly the old BT software from the system and after new reboot install the BT downloaded from the Toshiba BT page.
    Bye

Maybe you are looking for