当前位置: 技术问答>java相关
各位老大,让我的JFrame在屏幕上居中,应用哪个方法?!小弟感激不尽!
来源: 互联网 发布时间:2015-01-22
本文导语: | Dimension sc = kit.getScreenSize(); youFrame.setLocation(sc.width/2 ,sc.height/2); | ToolKit kit = ToolKit.getDefaultToolKit(); Dimension sc = kit.getScreenSize(); youFrame.setLocation((sc.width-WIDTH)/2 ,(sc.height-HEIGHT)/2);
|
Dimension sc = kit.getScreenSize();
youFrame.setLocation(sc.width/2 ,sc.height/2);
youFrame.setLocation(sc.width/2 ,sc.height/2);
|
ToolKit kit = ToolKit.getDefaultToolKit();
Dimension sc = kit.getScreenSize();
youFrame.setLocation((sc.width-WIDTH)/2 ,(sc.height-HEIGHT)/2);
Dimension sc = kit.getScreenSize();
youFrame.setLocation((sc.width-WIDTH)/2 ,(sc.height-HEIGHT)/2);