设置标签SWT固定尺寸 [英] Set Label SWT fixed size

查看:159
本文介绍了设置标签SWT固定尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我想设置标签尺寸以固定尺寸.
并且不更改其文字的标签大小
我该怎么办?

谢谢

Hi i want to set a label size to fix size.
and not change the label size acceding to it''s text
how can I do it please?

Thanks

推荐答案

您必须将LayoutData添加到Label.
这个Data对象基本上由一些约束组成,告诉标签如何看.

You have to add LayoutData to the Label.
This Data object is basically consisting of some constrains, telling the label how to look.

Label oLabel = new Label (parent, SWT.NONE);

GridData oGridData = new GridData ();
oGridData.widthHint = 50;
oLabel.setLayoutData (oGridData);



如果您需要一次以上的通用实现,则应该考虑一下(例如,使所有标签看起来都一样).



You should think about a generalized implementation if you need it more than once (e.g. to get all labels look the same).


这篇关于设置标签SWT固定尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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