Java JFaces对话框调整大小为零行
我已经使用JFace创建了一个Java JFaces对话框调整大小为零行,java,dialog,swt,jface,Java,Dialog,Swt,Jface,我已经使用JFace创建了一个对话框,并使用SWT将其设置为可调整大小。RESIZE。 但是,它允许用户将其调整为0行,其中只有标题栏可见 有没有一种方法可以限制用户只调整到一定数量的行?使用Shell\setMinimumSize(int,int)如下: public class MyDialog extends Dialog { public static void main(String[] args) { new MyDialog(new Shell())
对话框
,并使用SWT将其设置为可调整大小。RESIZE
。
但是,它允许用户将其调整为0行,其中只有标题栏可见
有没有一种方法可以限制用户只调整到一定数量的行?使用Shell\setMinimumSize(int,int)
如下:
public class MyDialog extends Dialog
{
public static void main(String[] args)
{
new MyDialog(new Shell()).open();
}
public MyDialog(Shell parentShell)
{
super(parentShell);
setShellStyle(SWT.RESIZE | SWT.DIALOG_TRIM);
}
@Override
protected Control createDialogArea(Composite parent)
{
Composite container = (Composite) super.createDialogArea(parent);
getShell().setMinimumSize(400, 300);
new Button(container, SWT.PUSH).setText("Some content here");
return container;
}
}
这将限制用户将尺寸减小到400宽300高以下
但是请记住不同的屏幕分辨率,因为强制的最小大小可能会超过可用的屏幕大小