如何右对齐 Java SWT
应用程序中的复选框?这是我的代码片段:
Button checkFullECR = new Button(scrolledForm.getBody(), SWT.CHECK);
checkFullECR.setAlignment(SWT.RIGHT);
checkFullECR.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
checkFullECR.setText("I need the complete ECR/ECN Process:");
它看起来像下面这样:
[ ] I need the complete ECR/ECN Process:
我希望它看起来像:
I need the complete ECR/ECN Process: [ ]
最佳答案
仅使用 Button
控件无法做到这一点,您需要使用 Label
作为文本和复选框 Button
没有文本排列在两列中。
类似于:
Composite body = new Composite(parent, SWT.NONE);
body.setLayout(new GridLayout(2, false));
Label label = new Label(body, SWT.LEFT);
label.setText("I need the complete ECR/ECN Process:");
Button checkFullECR = new Button(body, SWT.CHECK);
... more label / button pairs ....
关于java - 如何右对齐 Java SWT 应用程序中的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31995914/