您的位置:首页 > 其它

swt设置窗体居中

2006-11-27 14:37 225 查看
shell = new Shell();
shell.setSize(611, 375);
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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: