Java SWT:如何将窗口设置为可调整大小 \ 不能即时调整大小? [英] Java SWT: How to set the window to be resizable \ not resizable on the fly?

查看:53
本文介绍了Java SWT:如何将窗口设置为可调整大小 \ 不能即时调整大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过大量搜索和研究,我找不到任何答案.我将非常感谢能帮助我的人.

After a lot of search and research, I couldn't find any answer. I will very appreciate the person that could help me.

在 SWT java 中,我希望我的窗口不能调整大小,所以我这样定义它:

In SWT java, I want my window to be not resizable, so I define it like this:

shell = new Shell(SWT.CLOSE | SWT.TITLE | SWT.MIN);

但后来我想将其更改为可调整大小(例如在我单击按钮后).如何即时更改外壳的样式?

But then I want to change it to be resizable (for example after I click a button). How can I change the style of the shell on the fly?

推荐答案

Shell 的样式一旦创建就无法更改,因此无法直接执行此操作.

You can't change the style of a Shell once it has been created so you can't do this directly.

>

您可以做的是使用所需的样式创建一个新的 Shell(及其所有内容),并将其边界设置为与旧的 Shell 相同,然后关闭旧外壳.当 Eclipse 想要将工具提示窗口转换为普通窗口时,它会执行此操作.

What you can do is create a new Shell (and all its contents) with the desired style and set its bounds to be the same as the old Shell and then close the old shell. Eclipse does this when it wants to convert a tool tip window in to a normal window.

这篇关于Java SWT:如何将窗口设置为可调整大小 \ 不能即时调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆