gpt4 book ai didi

java - 如何右对齐 Java SWT 应用程序中的复选框

转载 作者:行者123 更新时间:2023-12-02 18:31:03 25 4
gpt4 key购买 nike

如何右对齐 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com