Java Toolkit Getting Second screen size

You should take a look at GraphicsEnvironment.

In particular, getScreenDevices():

Returns an array of all of the screen GraphicsDevice objects.

You can get the dimensions from those GraphicDevice objects (indirectly, via getDisplayMode). (That page also shows how to put a frame on a specific device.)

And you can get from a JFrame to its device via the getGraphicsConfigration() method, which returns a GraphicsConfiguration that has a getDevice(). (The getIDstring() method will probably enable you to differentiate between the screens.)

Leave a Comment