only one swing frame window opened at time

Here is an example of a Java Single Application Instance:

A single instance application is one that only allows for 1 of the application to run no matter how many times the user tries to launch.

See also: A shorter example that does not notify the running instance.

The application tries to open a Socket on a specific port. In case another instance of your application is already running, opening the Socket fails.

This should already be sufficient for you, so you would not have to use the part of the code used to register new applications to the first one started.

Using a Socket has one great advantage compared to writing some sort of flag to the filesystem/registry/whatever:
It is removed even if your application crashes.

Tags:

Java

Swing