使用 JFace 的不可调整大小的窗口
我如何使用 JFace API 设置不可调整大小的窗口。考虑下面创建应用程序窗口的代码。我找不到任何方法来设置窗口在 shell 对象或应用程序窗口父级上不可调整大小。我有什么遗漏的吗?
public class Application extends ApplicationWindow
{
public Application()
{
super(null);
}
protected Control createContents(Composite parent)
{
prepareShell();
return parent;
}
protected void prepareShell() {
Shell shell = getShell();
shell.setSize(450, 300);
}
public static void main(String[] args)
{
Application app = new Application();
app.setBlockOnOpen(true);
app.open();
Display.getCurrent().dispose();
}
}
感谢您的帮助。
I how it's possible to setup non resizable window with JFace API. Consider code below that creates application window. I can't find any methods to setup window as not resizable on shell object or application window parent. Is there something I'm missing?
public class Application extends ApplicationWindow
{
public Application()
{
super(null);
}
protected Control createContents(Composite parent)
{
prepareShell();
return parent;
}
protected void prepareShell() {
Shell shell = getShell();
shell.setSize(450, 300);
}
public static void main(String[] args)
{
Application app = new Application();
app.setBlockOnOpen(true);
app.open();
Display.getCurrent().dispose();
}
}
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解,您希望在创建 shell 之前设置 shell 样式位。
只需添加
到您的班级即可。这省略了 SWT.RESIZE 样式位,因此阻止了调整大小。
As far as I understand you, you want to set shell style bits prior to the shell creation.
Simply add
to your class, to do so. This omits the SWT.RESIZE style bit, therefore prevents resizing..