Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layout, which will wrap it's content automatically?

Tags:

java

layout

swt

I have a composite A, which should contains another composite B.
Composite B will change it's size.

What layout should I apply to composite A, so that it will wrap composite B automatically?

like image 494
Skip Avatar asked Mar 11 '26 23:03

Skip


1 Answers

I think that a GridLayout will work for you but keep in mind that you have to tell compositeB to SWT.FILL not the other way around:

Composite compositeA = new Composite(parent, SWT.NONE);
compositeA.setLayout(new GridLayout(1, false));

Composite compositeB = new Group(compositeA, SWT.NONE);
compositeB.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
like image 95
Adam Arold Avatar answered Mar 13 '26 11:03

Adam Arold



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!