JavaSWT:表格滚动不';我不能在对话中工作

JavaSWT:表格滚动不';我不能在对话中工作,java,swt,windowbuilder,Java,Swt,Windowbuilder,我需要在对话框中添加一个表,并用假内容填充它。显示对话框时,表格没有滚动,因此末端的内容不可见 也许这与对话框无法调整大小有关?我找不到调整对话框大小的方法。有可能吗 这是我打开对话框的方式: BetClubDialog dialog = new BetClubDialog(getShell(), SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL, null); String result = dialog.open(); 这是我的对话框,其中包含一个表和虚拟内容: pu

我需要在对话框中添加一个表,并用假内容填充它。显示对话框时,表格没有滚动,因此末端的内容不可见

也许这与对话框无法调整大小有关?我找不到调整对话框大小的方法。有可能吗

这是我打开对话框的方式:

BetClubDialog dialog = new BetClubDialog(getShell(), SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL, null);
String result = dialog.open();
这是我的对话框,其中包含一个表和虚拟内容:

public class BetClubDialog extends Dialog {

    protected String result;
    protected Shell shell;
    private Club clubToEdit;

    /**
     * Create the dialog.
     * @param parent
     * @param style
     */
    public BetClubDialog(Shell parent, int style, Club clubToEdit) {
        super(parent, style);
        this.clubToEdit = clubToEdit;
        setText("Gestionar Peña de Apuesta");
    }

    /**
     * Open the dialog.
     * @return the result
     */
    public String open() {
        createContents();

        Rectangle parentSize = getParent().getBounds();
        Rectangle shellSize = shell.getBounds();
        int x = parentSize.x + (parentSize.width - shellSize.width) / 2;
        int y = (int) (parentSize.y + (parentSize.height - shellSize.height) / 3.5);
        shell.setLocation(new Point(x, y));
        shell.setLayout(new GridLayout(1, false));

        Composite topComposite = new Composite(shell, SWT.NONE);
        topComposite.setLayout(new GridLayout(2, false));
        topComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));

        Label lblClubName = new Label(topComposite, SWT.NONE);
        lblClubName.setText("Peña:");

        Label lblClubNameValue = new Label(topComposite, SWT.NONE);
        lblClubNameValue.setText("Dummy");

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

        Table membersTable = new Table(clubComposite, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION);
        membersTable.setHeaderVisible(true);
        GridData gd_membersTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        gd_membersTable.minimumHeight = -1;
        membersTable.setLayoutData(gd_membersTable);

        TableColumn tblclmnName = new TableColumn(membersTable, SWT.NONE);
        tblclmnName.setWidth(150);
        tblclmnName.setText("Nombre");

        TableColumn tblclmnCommonPhoneNumber = new TableColumn(membersTable, SWT.NONE);
        tblclmnCommonPhoneNumber.setWidth(120);
        tblclmnCommonPhoneNumber.setText("Teléfono");

        TableColumn tblclmnCommonMoney = new TableColumn(membersTable, SWT.NONE);
        tblclmnCommonMoney.setWidth(150);
        tblclmnCommonMoney.setText("Participación Habitual");   

        // populate Table
        for (int i=0; i<50; i++) {
            TableItem tableItem = new TableItem(membersTable, SWT.NONE);                    
            tableItem.setText(new String[] {"person "+i, "610610620", "100"});
        }                       

        shell.open();
        shell.layout();
        Display display = getParent().getDisplay();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }

        return result;
    }

    /**
     * Create contents of the dialog.
     */
    private void createContents() {
        shell = new Shell(getParent(), getStyle());
        shell.setSize(550, 550);
        shell.setText(getText());
    }
}
公共类BetClubDialog扩展对话框{ 保护字符串结果; 保护壳; 私人俱乐部; /** *创建对话框。 *@param父级 *@param风格 */ 公共BetClubDialog(Shell父级、int样式、Club clubToEdit){ 超级(父母,风格); this.clubToEdit=clubToEdit; setText(“Gestior Peña de Apuesta”); } /** *打开对话框。 *@返回结果 */ 公共字符串open(){ createContents(); 矩形parentSize=getParent().getBounds(); 矩形shellSize=shell.getBounds(); intx=parentSize.x+(parentSize.width-shellSize.width)/2; inty=(int)(parentSize.y+(parentSize.height-shellSize.height)/3.5); 外壳设置位置(新点(x,y)); shell.setLayout(新的GridLayout(1,false)); 复合材料顶部复合材料=新复合材料(壳体,SWT.NONE); setLayout(新的GridLayout(2,false)); setLayoutData(新的GridData(SWT.CENTER,SWT.CENTER,false,false,1,1)); 标签lblClubName=新标签(topComposite,SWT.NONE); lblClubName.setText(“佩尼亚:”); 标签lblClubNameValue=新标签(topComposite,SWT.NONE); lblClubNameValue.setText(“虚拟”); 复合clubComposite=新复合材料(外壳,SWT.NONE); setLayout(新的GridLayout(1,false)); setLayoutData(新的GridData(SWT.FILL,SWT.FILL,true,true,1,1)); Table membersTable=新表(clubComposite,SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION); membersTable.setheadervible(true); GridData gd_membersTable=新的GridData(SWT.FILL,SWT.FILL,true,true,1,1); gd_membersTable.minimumHeight=-1; setLayoutData(gd_membersTable); TableColumn tblclmnName=新的TableColumn(membersTable,SWT.NONE); tblclmnName.setWidth(150); tblclmnName.setText(“Nombre”); TableColumn tblclmnCommonPhoneNumber=新的TableColumn(membersTable,SWT.NONE); tblclmnCommonPhoneNumber.setWidth(120); tblclmnCommonPhoneNumber.setText(“电话号码”); TableColumn TBLCLMNCommoney=新的TableColumn(membersTable,SWT.NONE); TBLCLMNCommoney.setWidth(150); tblclmncommoney.setText(“惯常参与”); //填充表
对于(int i=0;iOK),我最终解决了它,删除了这一行:

 gd_membersTable.minimumHeight = -1;