Java JFace应用程序窗口的最小大小

Java JFace应用程序窗口的最小大小,java,swt,jface,Java,Swt,Jface,我刚开始使用JFace/SWT进行GUI编程。在使用普通SWT窗口()之前,今天我第一次尝试了JFace应用程序窗口 现在我想设置此窗口的最小大小。。在SWT中,它与 shell.setMinimumSize(100,100) 但是在我的org.eclipse.jface.window.ApplicationWindow中没有这样的方法 我试过了 this.createShell().setMinimumSize(100, 100); (我的实现“公共类MainView扩展应用程序窗口{”)

我刚开始使用JFace/SWT进行GUI编程。在使用普通SWT窗口()之前,今天我第一次尝试了JFace应用程序窗口

现在我想设置此窗口的最小大小。。在SWT中,它与

shell.setMinimumSize(100,100)
但是在我的org.eclipse.jface.window.ApplicationWindow中没有这样的方法

我试过了

this.createShell().setMinimumSize(100, 100);
(我的实现“公共类MainView扩展应用程序窗口{”)

但它不起作用

this.getShell()
返回null

顺便说一句,我在gernal中搜索了一个关于JFace的好文档,现在尤其是在应用程序窗口中,但是我找不到任何真正好的和广泛的文档

SWT中的文档,尤其是JFace中的文档非常令人失望。太糟糕了,因为其中有一些很好的特性


您的体验是什么?

从createShell方法的文档中可以看到,它创建了一个新的shell。您需要使用窗口的现有/创建的shell

您可以从应用程序的父组合中获取它。请参阅以下代码段中的createContents方法:

package helloproject;

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;

public class HelloWorld extends ApplicationWindow {

    public HelloWorld() {
        super(null);
    }

    /**
     * Runs the application
     */
    public void run() {
        setBlockOnOpen(true);
        open();
        Display.getCurrent().dispose();
    }

    protected Control createContents(Composite parent) {
        // Create a Hello, World label
        Label label = new Label(parent, SWT.CENTER);
        label.setText("Hello, World");

        // Set the minimum size
        parent.getShell().setMinimumSize(200, 200);

        return label;
    }

    public static void main(String[] args) {
        new HelloWorld().run();
    }
}

覆盖
configureShell
方法并在其中设置最小大小:

@Override
protected void configureShell(Shell newShell)
{
  super.configureShell(newShell);

  newShell.setMinimumSize(100, 100);
}