gpt4 book ai didi

java - 为什么SWT List填充全复合?

转载 作者:行者123 更新时间:2023-12-01 13:45:02 25 4
gpt4 key购买 nike

您好,我对 SWT 中的布局有疑问,我想创建一个具有 4 个大小相等的列表的应用程序。当列表为空时,每个列表看起来都不错,但是当我用覆盖整个组合的数据来填充其中一个列表时。

Empty Lists

并列出数据:

enter image description here

我知道它的布局错误,所以我将向您展示一些来源:

shlPirotechnikafcwnxrap.setLayout(new FillLayout(SWT.HORIZONTAL));

......

Composite mainComposite = new Composite(shlPirotechnikafcwnxrap,
SWT.NONE);
mainComposite.setLayout(new FormLayout());

......

Composite rightCenterComposite = new Composite(mainComposite, SWT.NONE);
rightCenterComposite.setLayoutData(new FormData());
rightCenterComposite.setLayout(new GridLayout());
rightCenterComposite.setLayoutData(GUIHelper.getFormData(5, 100, 30, 100));

TabFolder tabFolder = new TabFolder(rightCenterComposite, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

/**
* TAB ITEM
*/
TabItem tbtmSql = new TabItem(tabFolder, SWT.NONE);
tbtmSql.setText("SQL");

/**
* Composite inside TabItem
*/
Composite sqlTabComposite = new Composite(tabFolder, SWT.NONE);
GridLayout gl_sqlTabComposite = new GridLayout();
gl_sqlTabComposite.makeColumnsEqualWidth = true;
gl_sqlTabComposite.numColumns = 2;
sqlTabComposite.setLayout(gl_sqlTabComposite);
sqlTabComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
tbtmSql.setControl(sqlTabComposite);

Group grpSowaKluczoweSql = new Group(sqlTabComposite, SWT.NONE);
grpSowaKluczoweSql.setLayout(new FormLayout());
grpSowaKluczoweSql.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
grpSowaKluczoweSql.setText("S\u0142owa kluczowe i operatory SQL:");

List listSlowaKluczoweSql = new List(grpSowaKluczoweSql, SWT.BORDER | SWT.V_SCROLL);
listSlowaKluczoweSql.setLayoutData(new FormData());
listSlowaKluczoweSql.setLayoutData(GUIHelper.getFormData(0, 100, 0, 100));

Group grpTabele = new Group(sqlTabComposite, SWT.NONE);
grpTabele.setLayout(new FormLayout());
grpTabele.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
grpTabele.setText("Nazwy tabel:");

List listTabele = new List(grpTabele, SWT.BORDER | SWT.V_SCROLL);
listTabele.setLayoutData(new FormData());
listTabele.setLayoutData(GUIHelper.getFormData(0, 100, 0, 100));

最佳答案

这是因为: sqlTabComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 您正在使用 FILL + 抓取多余的空间。尝试使用适当的布局常量,例如用于水平对齐的 BEGINNING 和用于垂直对齐的 TOP。还将grabExcessVerticalSpace 设置为 false。检查所有相关位置。

关于java - 为什么SWT List填充全复合?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20420867/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com