zachary zachary - 1 year ago 92
Java Question

How to make GridLayout row fill availible space?

I have a

. I have two rows. I want one row to take up 500 pixels. I want the other row to take up the rest of the space.

How can I do this?

Answer Source

That's not a property of the GridLayout, but of the contained widgets' layout data. 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 );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download