Minimizing java GUI to sys tray

I want to write an alarm scheduler GUI which will continuously run on the system, both Windows and Mac. Here are the tasks I need to accomplish:
1) When the user clicks on the close window or "X" sign, I simply want to minimize the gui to sys tray in case of Windows, or push it to background in case of Mac (somehow hide the GUI from the screen in both cases).
2) Another requirement is that if the user starts the program from desktop by clicking on an icon, the program should check to see if an instance of itself is already running, and if so, load the running instance. And what i mean by that is to bring the GUI back to screen. If the program is not already running, start a brand new instance of it.
Any help would be much appreciated.

Prometheus, appreciate the help. But using singleton pattern doesnt solve the problem. Here is my code for singleton and the test classes.
package com.vetinsite.scheduler;
public class Singleton {
    private static com.vetinsite.scheduler.Singleton uniqueInstance;
    private int var;
    private Singleton() {}
    public static synchronized Singleton getInstance(){
        if(uniqueInstance == null){
             uniqueInstance = new Singleton();
        return uniqueInstance;
    public void setVar(int v){
        this.var = v;
    public void print(){
        System.out.println(var);
package com.vetinsite.scheduler;
public class Test1 {
    public static void main (String argv[]){
        com.vetinsite.scheduler.Singleton single = Singleton.getInstance();
        single.setVar(1);
        single.print();
        single.setVar(2);
        try{
             Thread.sleep(10000);
        catch (Exception e){}
        single = Singleton.getInstance();
        single.print();
package com.vetinsite.scheduler;
public class Test2 {
    public static void main (String argv[]){
        com.vetinsite.scheduler.Singleton single = Singleton.getInstance();
        single.print();
}I run Test1 which sets the singleton's "var" variable to 1 and then 2. Then sleeps for 10 second. Within the 10 sec period I run Test2 expecting it to print out "2", but it instead prints "0". I guess my understanding of singleton pattern is wrong, becoz I thought if two different classes in the same package tried to instantiate the singleton object, it would one create one instance. But in this test its obviously creating two.
If I cant use singleton pattern, is there any other means by which I can reload the running instance of a GUI.

Similar Messages

  • Hiding the GUI to system tray or background

    I want to write an alarm scheduler GUI which will continuously run on the system, both Windows and Mac. Here are the tasks I need to accomplish:
    1) When the user clicks on the close window or "X" sign, I simply want to minimize the gui to sys tray in case of Windows, or push it to background in case of Mac (somehow hide the GUI from the screen in both cases).
    2) Another requirement is that if the user starts the program from desktop by clicking on an icon, the program should check to see if an instance of itself is already running, and if so, load the running instance. And what i mean by that is to bring the GUI back to screen. If the program is not already running, start a brand new instance of it.
    Any help would be much appreciated.

    Don't cross post , please!
    Answered here: http://forum.java.sun.com/thread.jspa?threadID=5167315

  • JAVA GUI Builder

    Hi,
    Does anyone know any "good" Java GUI Builder?
    Thank all.
    Dang Nguyen Duc

    There is a combination of tools you may find useful:
    Eclipse as an IDE - free and downloadable from eclipse.org
    Plugin for Eclipse called swt-designer. Free version for non-commercial use; very minimal price (~$200) for commercial use (one seat).
    Caveat: This is built around using SWT, not AWT/Swing.
    JBuilder also has GUI building tools.

  • Can I Open an HTMLHelp (*.CHM) File from Java GUI Application?

    I ussually use Delphi to develop my applications and I can open an HTMLHelp (*.CHM) file from my application. Can you show me the ways to do it from my Java GUI applications?
    Thanks for everyone.
    Budi Raharjo
    http://budiraharjo.blogspot.com

    http://www.google.com/search?q=java+chm
    Seems like there is some 3rd party software available for that.

  • New Features for Java GUI

    Hello everyone!
    Can anybody tell about new features in SAP GUI for Java. I think It's emasculate now. It doesn't contain New ABAP editor, Network graphic, normal Screen Painter... I really enjoy adding themes and other stuff, but when these functionality will be added?
    Thanks.

    Hi,
      I use Java GUI from version 6.40, so i didn't know new ABAP editor for years. Once somebody shows me its features ...and I found that it is really good editor compared with previous Notepad-like frontend editor. But I have to say that customized version od Gvim used as external editor is in 90% better then new ABAP editor (the only problem is that double click on object doesn't work, but some workarounds are known for double-click on locally defined objects).
    Graphical screen painter is generally good tool, but once I cannot find any feature (sorry, I forgot which one, it happens about 6 years ago). I ask a SAP guru sitting near me. He comes, switch graphical screen painter off and click to a box in non-graphical version of screen painter. Then he told me that some features are not accessible in graphical screen painter. It was last time I used graphical version of screen painter.
    Themes? Works .... at least for me (Linux 32 bit and now Linux 64 bit too).
    So I think that Java GUI is usable (at least on Linux/Mac, I am not sure how in works under Windows) but you cannot stick on all features (and maybe you can find better working variants of it). E. g. I have no problem with new ABAP editor, it would be much better for me, if I can open external editor clicking to "Change" button in SE38 directly instead of click plus selecting external editor from menu.
    Regards,
      Pavel

  • JAVA GUI window content does not fill out when window is enlarged (Win,Mac)

    I've been using the SAP JAVA GUI on a Windows XP workstation as well as a couple of MacBooks running OS X over the last year and a half or so, running versions from 7.10 r 7(maybe earlier) thru 7.10 r 10 (installed today.) The GUI has performed generally well on these platforms, but has one major irritation.
    When I open certain pop-up windows, such as the SPAD [List of Output Requests > Status Description |http://img171.imageshack.us/i/screenshot20091006at241.png/|screenshot], it usually does not open a  large enough window to display all the data - one must scroll horizontally and/or vertically to see the entire window content.  The real aggravation is that if [one enlarges the window|http://img101.imageshack.us/i/screenshot20091006at242.png/|screenshot] so as to see more data, the resizing is ignored.  The contents of the window are still displayed within the original window boundaries instead of filling out the expanded window.   It is not possible to get the entire window contents displayed, it is still necessary to scroll around.
    What am I missing here?   How can I get window resizing to work correctly?   (Or is there a way to make such windows at least open up at a larger initial size??)
    I only found one other thread in this forum, Sap gui screen size in ubuntu., which seemed to be addressing the same problem, but the suggestion was to apply the latest patch to the GUI and get JAVA 1.6.   One would think that since that post in 2008, any patches would have made it into the latest revisions.  I'm already running Java 1.6.
    SAPGUI for Java 7.10 rev 10
    (Version ID 071000041000)
    Tue Sep 8 09:49:53 MEST 2009
    uw1059, 710_REL, 1093492
    Java VM: Apple Inc. Version 1.6.0_15
    OS: Mac OS X(i386) Version 10.6.1
    SAPGUI for Java 7.10 rev 10
    (Version ID 071000041000)
    Tue Sep 8 09:49:53 MEST 2009
    uw1059, 710_REL, 1093492
    Java VM: Sun Microsystems Inc. Version 1.6.0_15
    OS: Windows XP(x86) Version 5.1
    Any suggestions?  Anyone else even seeing this?
    Thanks!
    Rich

    I'm now running
    SAPGUI for Java 7.10 rev 11
    (Version ID 071000041100)
    Tue Dec 8 16:04:41 MET 2009
    uw1059, 710_REL, 1119101
    Java VM: Apple Inc. Version 1.6.0_17
    OS: Mac OS X(i386) Version 10.6.2
    I've also updated my XP system to 7.10 rev 11 and both continue to display the same failure to resize corrrectly.  
    Here's a [video capture of this behavior|http://img163.yfrog.com/i/sapresizebug.mp4/].
    Given that installs on two separate operating systems have consistently misbehaved like this, I have a hard time believing it is something  we are doing.  (But not that hard...)  I find it hard to believe that is the way these screens present on most SAP sites...
    Any comments or suggestions would be welcome!
    Rich

  • Cannot connect a Java GUI client to an EJB

    I am having problems trying to make a Java GUI client connect to an EJB. I am using JRun4.
    At first, I tried making the Java GUI client a part of the enterprise application that I am building (of which the EJB is a part of). I included the client as a Java module in the application.xml of the enterprise application.
    However, when I try to start the server, containing this application, I get an error saying:
    Application authentication required. Incorrect method call.
    Now when I try to execute the application from the console, it works fine except when it comes to the part when it has to connect to the EJB. At this point I get an java.lang.reflect.UndeclaredThrowableException. Here's the stack trace:
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy1.create(Unknown Source)
    at mds.Caller.actionPerformed(Caller.java:135)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: jrun.ejb.invocation.ContainerNotFoundException: The EJB container for boss-ejb#Boss could not be found.
    at jrun.ejb.invocation.AbstractInvocationProxy.findContainer(AbstractInvocationProxy.java:58)
    at jrun.ejb.invocation.LocalInvocationProxyImpl.invoke(LocalInvocationProxyImpl.java:53)
    at jrun.ejb.invocation.ClientInvocationHandlerImpl.invoke(ClientInvocationHandlerImpl.java:198)
    ... 25 more
    Since the bean is local, I am using a local reference to the bean in the lookup in the code of the client:
    Object o = context.lookup("local/BeanTest")
    I tried to use:
    Object o = context.lookup("java:comp/env/ejb/BeanTest")
    and added an ejb-local-ref in the application-client.xml file of the client. But when I try executing the client in this case, I get an error saying:
    No such binding: ejb
    I wish someone can help me out with this. My main aim is to get the app client talk to the EJB. Thanks a lot in advance.
    Soham

    I am not sure of a tool to view the JNDI tree. I have one in Weblogic console. But you can check the JNDI names with a small sample code.
    import java.util.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    public class TestEnvironment {
        public static void main(String[] args) {
            Context context   = null;
            Object object     = null;
            // Hashtable for environment properties.
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            env.put(Context.PROVIDER_URL, "t3://localhost:7001");
            try {
                context   = new InitialContext(env);
                NamingEnumeration enum = context.listBindings("");
                while (enum.hasMore()) {
                    Binding binding = (Binding) enum.next();
                    System.out.println("Name: " + binding.getName());
                    System.out.println("Type: " + binding.getClassName());
                    System.out.println("Value: " + binding.getObject());
            } catch (Exception exception) {
                exception.printStackTrace();
    }Hope this helps.

  • Is there any way by which I can not use Thunar Sys Tray icon?

    I am using stalonetray in OpenBox in Arch and when I copy-paste or cut-paste files in Thunar, a sys tray icon pops up. I don't want it to pop up.
    Is there any way by which I can make it to not pop up?

    Trilby wrote:
    I haven't used thunar for a while - but I don't remember it ever doing this before.  I just verified that it doesn't here (freshly installed thunar, and cut-pasted, copy-pasted, etc, and I didn't get a tray icon.
    Are you sure this isn't some other tool, like a clipboard manager?  Are their any tooltip popups or menus available on the tray icon and/or what happens when you click the icon?
    No. I use only Thunar. When I hover on the icon it says that "1 file operation running" when a copy-paste or cut-paste operation happens and when I left click and right click on it, it shows the copying window of thunar. The icon shows two small yellow folders placed diagonally. It's the same icon that appears on the file operation progress window of Thunar. I don't know whether Numix has anything to do with the specific icon though.
    Last edited by chosentorture (2015-01-11 00:13:32)

  • SAP Java Gui in Solaris 10 x86.

    Who run the Java Gui in Solaris 10 x86?
    After I installed Java Gui in Solaris 10 x86 and run guilogon, when I connect the server I created, I got the error message:
    Attempt to load shared library /opt/SAPClients/SAPGui7.00/binlibJPlatin.so failed.
    The library file exists, so either the program
    don't has the privileges to access the library
    or the library is not loadable by the shared object loader
    Technical information:
    Error location: GuiJniLoader.loadPlatinLibrary()
    Error message: /opt/SAPClients/SAPGUI7.00/bin/libJPlation.so:ld.so.1:java:fatal:/opt/SAPClients/SAPGUI7.00/bin/libJPlatin.so:wrong ELF data format:ELFDATA2MSB
    After I confirm the dialog, another error message appears:
    JniAgiLibAdaptor.<init>: Cannot load JNI library.
    I checked the supported OS, it doesn't contains Solaris 10 X86, but I think Solaris 10 was open source, just like linux, why doesn't SAP Java Gui support Solaris 10 X86? And now , how can I solve this problem?

    What you see is what happens when the Java runtime running on Solaris 10 x86 tries to load a library which is compiled for SPARC.
    Because of the native parts in SAP GUI for Java, compilations and installers are required for each OS - HW combination.
    The supported platforms can be seen in SAP note 954572. For Solaris only SPARC is currently supported.
    Because of the effort needed for compiling, testing, support etc. it is required to focus on OS - HW combinations widely used on desktop machines and Solaris 10 on x86 currently does not seem to be one of those.

  • Integrating Another Program Into A Java GUI

    HI
    I have 3 classes here. One is a Java GUI, the other two are involed in
    stripping and processing of information off a webpage.
    Of these latter two classes, one contains a main method which connects
    to a webpage and reads the info off it, it calls the other class which
    parses this information and holds the variables I need to create
    buttons for the main gui!
    Is it possible at all to integrate, the class that reads the webpage,
    into, the Java GUI class.I need to do this to access the variables
    that the parsing class is holding, as previously I have had to create
    an instance of this class in the webpage reader class, but this was no
    good to me as the GUI could not access this information, i.e can I
    create an instance of this stripper at the begining of main in the GUI
    class so as I can use the results for this for producing my buttons?
    I've tried to do this but I am getting unresolved symbol errors. I was
    wondering should I use global variables to hold the needed info also ?
    Any help at all greatly appreciated,
    Thanks
    Gerry

    I did what you're describing. Sounded simple enough. You put the same logic in main() into the applets init() and you can run as app or applet. Worked well in my IDE. Then the troubles start.
    Visit
    http://www.martinrinehart.com
    and read the Article, Launching Applets. That will get you started on launching a Swing application. (Try my Sample, DawnPainter, to give you an idea about how nice this can be when it works.) I promise but don't deliver (yet) an article on the javascript library I wrote that solves all the problems. For non-commercial use you can get your own copy:
    http://www.martinrinehart.com/examples/launchApplet.js

  • Cannot read list of frontend printers - Printing in SAP JAVA GUI for MAC

    Hello,
    I am trying to print a Spool request in SAP Java GUI 7.10. I am working on Apple with OSX operating system. I get this error message -
    " Cannot read list of frontend printers " - Message no. PO781
    What do i need to do to take a print out from SAP on my Mac.
    Thanks
    Buddy

    Hello,
    which printing access method you are using?
    You might want to have a look at [note 821519|https://service.sap.com/sap/support/notes/821519].
    Best regards
    Rolf-Martin

  • How can I run C programs under a Java GUI?

    Hi
    I'm looking for some info on how to run a command line program written in another language behind a Java GUI, any advice greatly appreciated, particularly in how to transfer data between the two.
    Thanks

    Runtime.getRuntime().exec(...)
    Transfering info is more complicated. Maybe write and read status from disk?

  • How to invoke Outlook Express to send mail in a JAVA GUI

    hi..
    i want to send a mail thru a java GUI...but when i press submit button..it has to invoke MS Outlook express and send the mail via this.
    pls reply soon..
    bi..

    Hi,
    When I execute the command like "Runtime.getRuntime().exec("cmd /c start mailto:[email protected]?subject=Test&body=Hello");" in my java program,There is no boby in my outlook window .could you give me some suggestion? Thank you very much!
    source:
    import java.io.IOException;
    public class TestAutoSendEMail {
         public static void main(String[] args) {
              try {  
                   Runtime.getRuntime().exec("cmd /c start mailto:[email protected]?subject=Test&body=Hello");
         catch (IOException ex) {  
         System.out.println(ex.getMessage());
    }

  • Printing local with JAVA Gui 7.10 on a MAC

    Hi,
    I installed the JAVA GUI 7.10 on my MacBook Pro and it all works fine. The only problem I have is local printing. Since I do not have SAPLPD anymore, I am not able to use local printing. Is there another possibility to do local printing with a Mac?
    Thanks Maarten

    Maarten,
    Yes.
    The following text is from Chapter 2. "Release Notes" / Section 2. "Missing Features" of the JavaGui HTML documentation:
    Front-End Printing Using SAPLPD (access method 'F') is only supported on Win32 platforms. For newer back-end versions, a new printing architecture for all platforms supported by SAP GUI for Java (access method 'G') is available, see SAP Note 821519 for details.

  • Accessibility and Java GUI testing

    Hi,
    Can java accessibility be used for developing java GUI testing tool for applet embedded in IE? If not is there any other way we can test Java Appet GUI?
    best regards
    Krishna

    I do not know of a free tool, but you can use the Robot class in Java to create what you need.

Maybe you are looking for