带有JFace的不可调整大小的窗口

mic*_*man 2 java swt jface resizable

我如何使用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();
    }
}
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助.

the*_*man 9

据我了解,您希望在创建shell之前设置shell样式位.

只需添加

@Override
public void create() {
    setShellStyle(SWT.DIALOG_TRIM);
    super.create();
}
Run Code Online (Sandbox Code Playgroud)

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