Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.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 正确设置ExpandBar大小_Java_Swt_E4 - Fatal编程技术网

Java 正确设置ExpandBar大小

Java 正确设置ExpandBar大小,java,swt,e4,Java,Swt,E4,我有一个上面有a的 正确答案组的定义在此之前进行: private void initCorrectAnswerGroup() { Group correctAnswerGroup = new Group(bar, SWT.BORDER); correctAnswerGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); correctAnswerGroup.

我有一个上面有a的

正确答案组的定义在此之前进行:

private void initCorrectAnswerGroup() {
    Group correctAnswerGroup = new Group(bar, SWT.BORDER);
    correctAnswerGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
            true, 1, 1));
    correctAnswerGroup.setLayout(new GridLayout(1, false));

    (new Label(correctAnswerGroup, SWT.NONE)).setText(LABEL_TASK_TXT);

    taskTxt = new StyledText(correctAnswerGroup, SWT.READ_ONLY
            | SWT.V_SCROLL | SWT.H_SCROLL);
    gdTaskTxt = new GridData(SWT.NONE, SWT.NONE, false, false, 1, 1);
    gdTaskTxt.widthHint = 800;
    gdTaskTxt.heightHint = 200;
    taskTxt.setLayoutData(gdTaskTxt);

    chooseAnswerTypeComposite = new Composite(correctAnswerGroup, SWT.NONE);
    chooseAnswerTypeComposite.setLayoutData(new GridData(SWT.FILL,
            SWT.NONE, true, false, 1, 1));
    chooseAnswerTypeComposite.setLayout(new GridLayout(1, false));

    Label answerTypeLabel = new Label(chooseAnswerTypeComposite, SWT.NONE);
    answerTypeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, true,
            false, 1, 1));
    answerTypeLabel.setText(LABEL_ANSWER_TYPE);

    answerTypeCombo = new Combo(chooseAnswerTypeComposite, SWT.READ_ONLY);
    answerTypeCombo.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, true,
            false, 1, 1));
    answerTypeCombo.setItems(new String[] { ANSWER_TYPE_STANDARD,
            ANSWER_TYPE_RULE });

    (new Label(correctAnswerGroup, SWT.NONE)).setText(LABEL_CORRECT_ANSWER);

    correctAnswerMsgTokenTextField = new TokenTextField(correctAnswerGroup,
            true, false, true, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    GridData gdETxtCorrAnsMsg = new GridData(SWT.FILL, SWT.FILL, true,
            false, 1, 1);
    gdETxtCorrAnsMsg.heightHint = 40;
    correctAnswerMsgTokenTextField.getText()
            .setLayoutData(gdETxtCorrAnsMsg);
}
但是,ExpandBar的大小不正确。它水平和垂直剪切窗口小部件,并且根本不显示滚动条。 它试着用setHeight方法来解决这个问题,但我所尝试的似乎都不起作用。。。 要使ExpandBar垂直拉伸到correctAnswerGroup的整个大小并水平显示滚动条,我必须做些什么

private void initCorrectAnswerGroup() {
    Group correctAnswerGroup = new Group(bar, SWT.BORDER);
    correctAnswerGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
            true, 1, 1));
    correctAnswerGroup.setLayout(new GridLayout(1, false));

    (new Label(correctAnswerGroup, SWT.NONE)).setText(LABEL_TASK_TXT);

    taskTxt = new StyledText(correctAnswerGroup, SWT.READ_ONLY
            | SWT.V_SCROLL | SWT.H_SCROLL);
    gdTaskTxt = new GridData(SWT.NONE, SWT.NONE, false, false, 1, 1);
    gdTaskTxt.widthHint = 800;
    gdTaskTxt.heightHint = 200;
    taskTxt.setLayoutData(gdTaskTxt);

    chooseAnswerTypeComposite = new Composite(correctAnswerGroup, SWT.NONE);
    chooseAnswerTypeComposite.setLayoutData(new GridData(SWT.FILL,
            SWT.NONE, true, false, 1, 1));
    chooseAnswerTypeComposite.setLayout(new GridLayout(1, false));

    Label answerTypeLabel = new Label(chooseAnswerTypeComposite, SWT.NONE);
    answerTypeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, true,
            false, 1, 1));
    answerTypeLabel.setText(LABEL_ANSWER_TYPE);

    answerTypeCombo = new Combo(chooseAnswerTypeComposite, SWT.READ_ONLY);
    answerTypeCombo.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, true,
            false, 1, 1));
    answerTypeCombo.setItems(new String[] { ANSWER_TYPE_STANDARD,
            ANSWER_TYPE_RULE });

    (new Label(correctAnswerGroup, SWT.NONE)).setText(LABEL_CORRECT_ANSWER);

    correctAnswerMsgTokenTextField = new TokenTextField(correctAnswerGroup,
            true, false, true, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    GridData gdETxtCorrAnsMsg = new GridData(SWT.FILL, SWT.FILL, true,
            false, 1, 1);
    gdETxtCorrAnsMsg.heightHint = 40;
    correctAnswerMsgTokenTextField.getText()
            .setLayoutData(gdETxtCorrAnsMsg);
}