1

I run a Swing GUI in a multi-monitor environment. From the Main-GUI I want to open a second screen. If the main GUI runs already in 2nd monitor, the new window should open in the 1st monitor.

So I'm looking for the possibility to get the monitor ID the current main GUI runs.

Any ideas?

  • 1
    Look at this issue and find the answer: http://stackoverflow.com/questions/4627553/java-show-jframe-in-a-specific-screen-in-dual-monitor-configuration – Stephan Apr 04 '12 at 10:58
  • not really. if i put the GUI to screen 1 and the user move es to screen 2, the new GUI will appear in screen 2 too. but then it should be opened in the first.

    so i must read the screen from the JPanel
    – ReloadRabbit Apr 04 '12 at 11:21

1 Answers1

3

GraphicsEnvironment class should be of help here.

A similar question has been answers here.

It is most likely necessary to track the location of frames (i.e. where a user dragged them) in order to identify on which screen a frame is located at any given point in time. This can be done by monitoring mouse events with respect to the screens as explained here.

Community
  • 1
  • 1
01es
  • 5,362
  • 1
  • 31
  • 40
  • With GraphicsEnvironment i got only the number of screens and there size, but no information if my application run in which screen... – ReloadRabbit Apr 04 '12 at 11:44