Satu
1 import java.awt.Toolkit;
2 
3 public class GetScreenSize {
4     public static void main(String[] args) {
5         int screenWidth = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
6         int screenHeight = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
7         System.out.println("The width of screen is " + screenWidth + ", and the height of screen is " + screenHeight);        
8     }
9 }

 

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

 

 

参考:https://blog.csdn.net/m_wbcg/article/details/55548654

分类:

技术点:

相关文章:

  • 2022-01-02
  • 2021-08-03
  • 2021-12-09
  • 2021-11-13
  • 2021-11-01
  • 2021-12-10
猜你喜欢
  • 2021-11-18
  • 2021-08-03
  • 2022-01-08
  • 2021-11-28
  • 2021-11-01
  • 2022-01-08
  • 2022-01-08
相关资源
相似解决方案