I would like to create all my widgets before inserting them into my swt Composite parent. But as I understand the parent is always specified in the constructor when a child is created:
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
...
// Create a child at first row leftmost location
Label labelConfigurator = new Label(container, SWT.NULL);
labelConfigurator.setText(title);
Is is possible to somehow separate the creation of widgets from the insertion/placement into the parent container?
No, there isn’t. There’s a little bit of explanation here.
Depending on what you want, a factory might help you; in the past I’ve used something like this:
with implementation
…which has helped me abstract away widget-building from most of my code. When I write a unit test, I mock the factory interface.