Displaying text on a swt button vertically

给你一囗甜甜゛ 提交于 2019-12-11 07:35:57

问题


I'm trying to display text on a button. Instead of displaying it as "Vertical", I'd like to display it as

V
e
r
t
i
c
a
l

Any assistance is much appreciated.


回答1:


You have to make your own widget to achieve it in SWT. Here is a complete example that you can try. Hope it helps.




回答2:


SWT buttons do support wrapping (since 3.7).

Button button = new Button(parent, SWT.PUSH | SWT.WRAP);
button.setText("V\ne\nr\nt\ni\nc\na\nl");

But unfortunately the lines will be centered as a whole and not individually, so the result does not look particularly good.



来源:https://stackoverflow.com/questions/8091920/displaying-text-on-a-swt-button-vertically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!