如何使swt窗口居中显示
来源:互联网 发布:mac toast and butter 编辑:程序博客网 时间:2024/06/05 20:49
(1)下面代码可以使swt窗口相对于整个显示器居中
shell.setLocation(Display.getCurrent().getClientArea().width / 2 - shell.getShell().getSize().x/2, Display.getCurrent()
.getClientArea().height / 2 - shell.getSize().y/2);
(2) 下面代码可以使swt窗口相对于父窗口居中
Rectangle parentBounds = parentShell.getBounds();
Rectangle shellBounds = shell.getBounds();
shell.setLocation(parentBounds.x + (parentBounds.width - shellBounds.width)/2, parentBounds.y + (parentBounds.height - shellBounds.height)/2);
shell.setLocation(Display.getCurrent().getClientArea().width / 2 - shell.getShell().getSize().x/2, Display.getCurrent()
.getClientArea().height / 2 - shell.getSize().y/2);
(2) 下面代码可以使swt窗口相对于父窗口居中
Rectangle parentBounds = parentShell.getBounds();
Rectangle shellBounds = shell.getBounds();
shell.setLocation(parentBounds.x + (parentBounds.width - shellBounds.width)/2, parentBounds.y + (parentBounds.height - shellBounds.height)/2);
- 如何使swt窗口居中显示
- 如何使swt窗口居中显示
- SWT 窗口居中
- 如何将窗口居中显示?
- SWT 使窗体程序居中显示
- Java SWT 窗口居中对齐
- SWT窗口居中的设置
- java 使窗口居中显示
- MFC应用程序如何让窗口居中显示
- centos中打开窗口如何居中显示
- SWT让窗体居中显示
- 如何使窗口自动居中?
- SWT窗口居中、渐显与渐隐
- java中使窗口居中显示
- 窗口弹出居中显示
- 弹出窗口居中显示
- 设置窗口居中显示
- 窗口居中显示
- Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
- 页异常中断
- VarIsEmpty与VarIsNull
- 新建网站与新建Asp.net Web应用程序的区别
- 【模拟退火】最小球POJ 2069/codeforces 82 E
- 如何使swt窗口居中显示
- asp.net 自己练习
- ExpandableListActivity
- Java--杨辉三角
- 【盛大连接】_JAVA版本SDK案例(含JSP调用及说明,全)源代码
- 设置MySQL支持远程链接
- 2011 最佳的 Linux 发行版
- 正则表达式使用学习(C++、Qt、Python)
- MySQL性能优化的最佳20+条经验