gpt4 book ai didi

java - 当我们在使用 swt 的 eclipse 插件开发中按下最大化按钮时,复合 Material 的宽度会发生变化

转载 作者:行者123 更新时间:2023-11-30 09:18:01 27 4
gpt4 key购买 nike

当我们使用 SWT 在 eclipse 插件开发中按下向导标题栏中的最大化按钮时,Composite 的宽度会发生变化。

我怎样才能克服这个问题?

注意:我没有使用KFaceWizardDialogShellDisplay。我只使用 Composite,我的主类正在实现 IWizard

public void createControl(Composite parent) 
{
// TODO Auto-generated method stub
composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());

/*GridLayout gridLayout = new GridLayout();
gridLayout.verticalSpacing = 10;
//gridLayout.makeColumnsEqualWidth = true;
//gridLayout.numColumns = 2;*/

Composite operationsListComposite = new Composite(composite, SWT.NONE);
operationsListComposite.setLayout(new GridLayout(2,false));
operationsListComposite.setLayoutData(new GridData(
GridData.FILL_HORIZONTAL));

Label operationLabel = new Label(operationsListComposite, SWT.NONE);
operationLabel.setText("");

//Label emptyLabel = new Label(operationsListComposite, SWT.NONE);
//emptyLabel.setText("");

Label adapterLabel = new Label(operationsListComposite, SWT.NONE);
adapterLabel.setText("");

fileGroupsList = new List(operationsListComposite,SWT.BORDER
| SWT.V_SCROLL | SWT.H_SCROLL);
fileGroupsList.add("JSP1");
fileGroupsList.add("JSP2");
fileGroupsList.add("JSP3");
fileGroupsList.add("JSP4");
fileGroupsList.addListener(SWT.Selection, this);

//operationsTree = new Tree(operationsListComposite,SWT.BORDER
// | SWT.V_SCROLL | SWT.H_SCROLL);
//operationsTree.addListener(SWT.Selection, this);
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
data.heightHint = 150;
data.widthHint=100;
//operationsTree.setLayoutData(data);
fileGroupsList.setLayoutData(data);


//filesList = new List(operationsListComposite,SWT.BORDER
// | SWT.V_SCROLL | SWT.H_SCROLL);
Composite css1Composite = new Composite(operationsListComposite, SWT.BORDER);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
//gridData.horizontalSpan= 2;
gridData.grabExcessHorizontalSpace = true;
css1Composite.setLayoutData(gridData);
GridLayout grpL = new GridLayout(3,false);
grpL.verticalSpacing=0;
css1Composite.setLayout(grpL);
}}

最佳答案

operationsListComposite.setLayoutData(new GridData(
GridData.FILL_HORIZONTAL));

告诉 SWT 您希望复合 Material 填充所有空间,这就是它在调整大小时扩展的原因。

GridData data = new GridData(SWT.BEGINNING, SWT.TOP, false, false);
data.widthHint = 100;
operationsList.setLayoutData(data);

停止复合以调整大小并给出建议大小 - 100。

编辑:您可能不需要宽度提示。

关于java - 当我们在使用 swt 的 eclipse 插件开发中按下最大化按钮时,复合 Material 的宽度会发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18739716/

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