简体   繁体   English

如何使GridLayout行填充可用空间?

[英]How to make GridLayout row fill availible space?

I have a GridLayout . 我有一个GridLayout I have two rows. 我有两排。 I want one row to take up 500 pixels. 我希望一行占用500像素。 I want the other row to take up the rest of the space. 我希望另一行占用其余空间。

How can I do this? 我怎样才能做到这一点?

That's not a property of the GridLayout, but of the contained widgets' layout data. 这不是GridLayout的属性,而是所包含的小部件的布局数据的属性。 Say your composite contains two widgets: 假设您的组合包含两个小部件:

parent.setLayout( new GridLayout() );

Button upper = new Button( parent, SWT.PUSH );
GridData upperData = new GridData( SWT.FILL, SWT.TOP, true, false );
upperData.heightHint = 500;
upper.setLayoutData( upperData );

Button lower = new Button( parent, SWT.PUSH );
GridData lowerData = new GridData( SWT.FILL, SWT.FILL, true, true );
lower.setLayoutData( lowerData );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM