Search code examples
javalayoutswtgrid-layout

How to align group components to the left


I want to use group boxes to improve my GUI. However when adding components to a Group they move to the center of the box and are not left aligned anymore. How do I get each button and text to move to the left margin. Group Box with centered elements

Code

GridLayout layout = new GridLayout(1, true);
layout.marginWidth = 300;
Group group = new Group(this, SWT.SHADOW_OUT);
group.setText("Open file locations");
group.setLayout(layout);

Button optionOne = new Button(group, SWT.CHECK | SWT.LEFT);
optionOne.setText(AppMessages.msg("Open file A") );

Button optionTwo = new Button(group, SWT.LEFT | SWT.CHECK);
optionTwo.setText(AppMessages.msg("Open file B") );

Need Space between two groups


Solution

  • Can u try to remove marginWidth from the layout