swt设置窗体居中

shell = new Shell();
shell.setSize(
611375);
int width = shell.getMonitor().getClientArea().width;
int height = shell.getMonitor().getClientArea().height;
int x = shell.getSize().x;
int y = shell.getSize().y;
if(x > width)
{
shell.getSize().x 
= width;
}
if(y > height)
{
shell.getSize().y 
= height;
}
shell.setLocation((width 
- x) / 2, (height - y) / 2);
发布了112 篇原创文章 · 获赞 3 · 访问量 37万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章