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);
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);
相关文章推荐
- swt设置窗体居中
- SWT 设置窗体透明和最上
- c# 设置窗体初始化为居中显示
- 设置窗体居中坐标图解及示例代码
- Java Swing设置主窗体位置居中方法
- SWT让窗体居中显示
- SWT窗体字体的设置
- SWT 使窗体程序居中显示
- 接下来将介绍C#如何设置子窗体在主窗体中居中显示,本文提供详细的操作步骤,需要的朋友可以参考下
- C#设置子窗体在主窗体中居中显示解决方案
- Qt之设置窗体居中显示
- GUI_如何设置窗体居中的代码
- SWT窗口居中的设置
- SWT窗体属性设置
- c#设置窗体在显示器居中显示
- C#-设置窗体在显示器居中显示
- C#怎么设置子窗体在主窗体中居中显示
- java设置窗体居中与去除边框以及jframe设置背景色
- Qt 设置窗口居中显示和窗体大小