[英]How to align group components to the left
我想使用組框來改善我的GUI。 但是,將組件添加到Group
它們將移動到框的中心,並且不再保持對齊狀態。 如何使每個按鈕和文本移到左邊距。
碼
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") );
按鈕保持左對齊,但是在對齊之前,您已指定300像素的邊距到按鈕的左側。
您為“ Group
或“ Composite
的布局指定的邊距值將設置控件中的邊距。
您是否可以嘗試從布局中刪除marginWidth
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.