TAM
TAM

Reputation: 347

Can DisplayMode set resolution to Screen Resolution?

So I am using the DisplayMode to set my resolution for a fullscreen as follows

DisplayMode dm = new DisplayMode(1440,900,64, DisplayMode.REFRESH_RATE_UNKNOWN);

My question is, Is there anything that I can put in place of 1440, 900 to get the app to set the resolution to whatever the computer it is running on is currently at?

Upvotes: 0

Views: 90

Answers (1)

MadProgrammer
MadProgrammer

Reputation: 347334

Take a look at Toolkit#getScreenResolution and Toolkit#getScreenSize for starters

You can also use (something similar to)

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();

Rectangle bounds = gd.getDefaultConfiguration().getBounds();

to get the screen bounds of given GraphicsDevice/screen (the example gets the default screen device)

Take a look at GraphicsEnvironment and GraphicsDevice for more details

Upvotes: 0

Related Questions