Here’s a little exmple on how to get the screen size of one or multiple monitors in Java.
Get the size of the default screen:
If more than one screen is available, this example gets the size of each screen:
GraphicsDevice[] gs = ge.getScreenDevices();
// Get size of each screen
for (int i=0; i<gs.length; i++) {
DisplayMode dm = gs[i].getDisplayMode();
int screenWidth = dm.getWidth();
int screenHeight = dm.getHeight();
}
Posted in Code Snippets,Java | Trackback Url








No Responses to “Getting the Screen Size in Java”
Trackbacks/Pingbacks
Leave a reply