Java 獲取屏幕的寬度和高度


獲取屏幕的寬度和高度

 1 import java.awt.Dimension;
 2 import java.awt.Toolkit;
 3 
 4 public class Main {
 5 
 6     public static void main(String[] args) {
 7         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
 8         System.out.println("The width and the height of the screen are " + screenSize.getWidth() + " x " + screenSize.getHeight());
 9     }
10 }

運行結果:

The width and the height of the screen are 1920.0 x 1080.0

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM