Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get the screen width in java?

Tags:

java

swing

Does anyone know how you would get the screen width in java? I read something about some toolkit method but I'm not quite sure what that is.

Thanks, Andrew

like image 431
Andrew Avatar asked Dec 20 '09 18:12

Andrew


People also ask

How do you change screen size in Java?

To change display mode with Java Swings, use the setDisplayMode() method. Here, we have set the Display mode as: new DisplayMode(800, 600, 32, 60)); Now, when you will run the program, the frame would be visible in a different resolution than the actual set resolution of your system.


1 Answers

java.awt.Toolkit.getDefaultToolkit().getScreenSize() 
like image 107
Ben McCann Avatar answered Sep 24 '22 04:09

Ben McCann