如何右对齐我的Java SWT应用程序中的复选框 [英] How do I right align the check box in my Java SWT application

查看:245
本文介绍了如何右对齐我的Java SWT应用程序中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的 Java SWT 应用程序中对齐复选框?这是我的代码片段:

How do I right align the check box in my Java SWT application ? Here is my code snippet:

    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:       [ ]


推荐答案

您不能使用按钮 control,您将需要为文本使用标签和不带有文本的复选框 Button 两列。

You can't do this using just a Button control, you will need to use a Label for the text and a checkbox Button with no text arranged in two columns.

像:

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 SWT应用程序中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆