This sample of code gives me the available screens for the current display:
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
But what I want to do is have a JFrame on different displays. (Different xorg servers running on the same physical computer).
Example.
export DISPLAY=:0.0
java myapp
This will show a popup in display 0.0 on any of the screens available.
export DISPLAY=:1.0
java myapp
This will show a popup in display 1.0 on any of the screens available
Now, what if I want to have one in display 1.0 and one in display 0.0 from the same application, what ever screen it is.
Basically, I want my application to run mainly with export DISPLAY=:1.0 but I want a status JFrame to be displayed in :0.0. How can I achieve that in Java? Any idea? Or, if this is not possible, I want to have AWT robot running in DISPLAY:1.0 and AWT displays in DISPLAY=:0.0
Do not confuse this with display 2 JFrames on 2 different screens from the same GraphicsEnvironment. That's easy and already replied. Here I'm talking about 2 JFrames on 2 different displays, each of them having 1 to x screens. So there is nothing in current question which is related to "java, show JFrame in a specific screen in dual monitor configuration". Please read carefully.
Example: Display 0.0 has 2 screens. Device 1 and Device 2. Display 1.0 is a VNC server display and has 1 screen. Device 1.
I want to display a JFrame on Display 0.0 device 2, and on display 1.0 device 1.
Getting all the devices for a single display is easy using getLocalGraphicsEnvironment(). But how can I get the other available displays and the related screens? Using bash command line I can using export DISPLAY to go to the one I want then use wmctrl to get the details. How can I do something similar with Java?
Update: I have found the X servers in the filesystem using this:
cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done
But still not fond how to say to a specific Java window to be displayed on one or on another one... Thanks.