带有JFace的不可调整大小的窗口 [英] Non resizable window with JFace

查看:360
本文介绍了带有JFace的不可调整大小的窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用JFace API设置不可调整大小的窗口。考虑下面创建应用程序窗口的代码。我找不到任何设置窗口的方法,因为在shell对象或应用程序窗口父级上无法调整大小。有什么我缺少的吗?

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();
    }
}

感谢您的帮助。

推荐答案

据我了解你,你想在shell创建之前设置shell样式位。

As far as I understand you, you want to set shell style bits prior to the shell creation.

简单地添加

@Override
public void create() {
    setShellStyle(SWT.DIALOG_TRIM);
    super.create();
}

到您的班级,这样做。这省略了SWT.RESIZE样式位,因此阻止了调整大小..

to your class, to do so. This omits the SWT.RESIZE style bit, therefore prevents resizing..

这篇关于带有JFace的不可调整大小的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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