#104 Single Instance Window Activation


I have an application that minimizes to the system tray and I generated my executable with launch4j. It all works wonderful, except for the following. I am using the single instance window title option. Almost all scenarios work, but there is one that hangs my GUI:

When I execute the second instance, this is what happens:

1. If window is open and active. It remains like that. That is ok.
2. If window is open but inactive. It becomes active and brought to the front. That is ok.
3. If window is hidden (the only GUI is the tray icon). The window is shown, brought to the front, but it does not respond to user interaction. Only when I use the tray icon's menu option to show the window, it is back to normal. What the menu option does is call setVisible(true) on the window's frame.

I am not sure if this is a bug on launch4j, or if I have to do something differently on my application.

For the time being I added a WindowListener to do a setVisible(true) at windowActivated(). It works, but it brings some other problems when there are JOptionPane dialogs opened. So maybe there is another option.


Log in to post a comment.