Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法正确查看JFace对话框中的小部件_Java_Eclipse_Eclipse Plugin_Swt_Jface - Fatal编程技术网

Java 无法正确查看JFace对话框中的小部件

Java 无法正确查看JFace对话框中的小部件,java,eclipse,eclipse-plugin,swt,jface,Java,Eclipse,Eclipse Plugin,Swt,Jface,我有一个JFace对话框,其中分别包含标签、文本和按钮。 我已经设置了对话框的初始大小,并且在我的机器中以我想要的方式设置了对话框 但在另一台机器上,我只看到部分按钮 这就是我重写createDialogArea方法的方式 @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent);

我有一个JFace对话框,其中分别包含标签、文本和按钮。 我已经设置了对话框的初始大小,并且在我的机器中以我想要的方式设置了对话框

但在另一台机器上,我只看到部分按钮

这就是我重写createDialogArea方法的方式

@Override
protected Control createDialogArea(Composite parent) 
{
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.numColumns = 3;

    new Label(container, SWT.NONE);
    new Label(container, SWT.NONE);
    new Label(container, SWT.NONE);

    Label fileLabel = new Label(container, SWT.NONE);
    fileLabel.setText("File Name :");

    fileText = new Text(container, SWT.BORDER);
    GridData fileTextGD = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    fileTextGD.widthHint = 319;
    fileText.setLayoutData(fileTextGD);
    fileText.setEnabled(false);

    browseButton = new Button(container, SWT.NONE);
    GridData browseButtonGD = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    browseButtonGD.widthHint = 28;
    browseButton.setLayoutData(browseButtonGD);
    browseButton.setText("...");

return container;
}
有什么问题吗


请建议您使用的
widthHint
值对于第二台机器上使用的字体来说可能太小。不要使用
widthHint
,让
GridLayout
为您计算尺寸