0

I am trying to find a way to know what kind of screen configuration the User is using.

For example, He could be having 2 screens positioned horizontally, or 2 vertically, or simply 1 or even 2 screen horizontally and 2 vertically (2x2).

Is there a way to catch that?

So far, I managed to get the amount of screens the User has.

int devices = g.getScreenDevices().length;
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
N3sh
  • 881
  • 8
  • 37
  • [This answer](http://stackoverflow.com/questions/3680221/screen-resolution-java) might help you – Fritz Mar 08 '13 at 13:37
  • It doesn't :(. I need to find their configuration. Like the one you can see in the Control Panel of Windows. [Screen 1 right, Screen 2 left] – N3sh Mar 08 '13 at 13:42
  • Silly me, you already have them. doesn't `g.getScreenDevices` return an array you can iterate through? – Fritz Mar 08 '13 at 13:44
  • 1
    *"I am trying to find a way to know what kind of screen configuration the User is using."* There is always 'ask them'. – Andrew Thompson Mar 08 '13 at 14:41

1 Answers1

0

You already have the different screens there. I suppose your g field is the local environment obtained through GraphicsEnvironment#getLocalGraphicsEnvironment. Then, by doing g.getScreenDevices you already have an array with the current screens (BTW, the line of code you posted shouldn't compile).

So, to access each scren you can do this:

GraphicsDevice[] devices = g.getScreenDevices();

for(GraphicsDevice currentDevice : devices) {
    DisplayMode deviceDisplayMode = currentDevice.getDisplayMode();
    //From here onwards, use deviceDisplayMode.getWidth() and
    //deviceDisplayMode.getHeight()
}
Fritz
  • 9,987
  • 4
  • 30
  • 49
  • The only way it could be useful would that it returns a matrix. I need to know that device[1] is the left one and so on. – N3sh Mar 08 '13 at 14:16