问题描述
如果我让按钮相对较小,它的标题会变成省略号.
如何关闭此功能?
不要让按钮低于它的首选大小,这样它就永远不需要删除按钮标签的文本:
button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
我想做一个很小的按钮
您可以单独或组合使用以下任何一项:
- 应用 CSS 以在按钮中使用非常小的字体.
- 使按钮的标签文本非常短.
- 使用 brian 的答案,建议将椭圆字符串显式设置为空.
- 使用小图形图标代替文本.
您可以在所有情况下使用上面记录的 setMinSize
(如果您希望按钮不低于截断或删除内容的首选大小).
在所有情况下,如果您愿意,您还可以应用 CSS 来最小化标签和按钮边框之间的填充.
根据您之前的评论(我想使用诸如<"和>"之类的简单标题),我认为选项 2(使按钮的标签文本非常短)就是您想要的.
您可能还对 Joel 的 为有更好事情要做的人而设计感兴趣生活这表明,在可用性方面,非常小的按钮通常是一个非常糟糕的主意.
If I make button relatively small, it's caption turns to ellipsis.
How to turn off this feature?
Don't let the button go below it's preferred size, then it will never need to elide the text of the button label:
button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
You can use any of the below either separately or in combination:
- Apply CSS to use a very small font in the button.
- Make the label text for the button very short.
- Use brian's answer which proposes explicitly setting the ellipse string to empty.
- Use a small graphic icon instead of text.
You can use setMinSize
as documented above in all cases (if you wish the button not to go below a preferred size truncating or eliding content).
In all cases, if you wish, you can also apply CSS to minimize the padding between the label and button the border.
From your previous comment (I want to use simple captions like "<" and ">"), I think option 2 (Make the label text for the button very short) is what you want.
You may also be interested in Joel's Designing for People Who Have Better Things To Do With Their Lives which would indicate, usability-wise that very small buttons are usually a pretty bad idea.
这篇关于如何防止文本在 JavaFX 中的小按钮上变成省略号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!