JAVA 读取平台的分辨率

// get screen size

Toolkit kit = Toolkit.getDefaultToolkit();

Dimension screenSize = kit.getScreenSize();

int width = screenSize.width;

int height = screenSize.height;

JFrame jf = new JFrame();

jf.setBounds(width/3,height/3,400,400);

jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

jf.setTitle("SimpleFrame test");

jf.setVisible(true);

// frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//frm.setUndecorated(true);

// frm.setVisible(true);

你可能感兴趣的:(JAVA 读取平台的分辨率)