How to get the resolution of the display in the Java program

xiaoxiao2021-03-05  28

. Import java.awt *; public class GetScreenSize {public static void main (String [] str) {Toolkit toolkit = Toolkit.getDefaultToolkit (); Dimension scrnsize = toolkit.getScreenSize (); System.out.println ( "Screen size: " Scrnsize.width " * " scRnsize.height);}}

My computer (generally doing this resolution) Output: Screen Size: 1024 * 768

With this method, you can do a lot of screen positioning.

转载请注明原文地址:https://www.9cbs.com/read-34994.html

New Post(0)