JButton页边距.当雨云pl时不被尊重 [英] JButton margins. Not respected when nimbus plaf
问题描述
安装雨云外观时,不尊重JButton
的属性margin
.
.
我需要一些小"按钮,但是nimbus会迫使按钮文本周围的空间变大,因此我只会得到非常大"的按钮.
我在 nimbus默认页面中发现了一个名为:
The property margin
of a JButton
isn't respected when the nimbus look and feel is installed.
.
I need some "little" buttons, but nimbus forces the space around button text to be large, so I only get "very large" buttons.
I discovered in nimbus defaults page that there is a property called:
Button.contentMargins
预设为大值.
我尝试使用以下代码覆盖它:
that is preset with large values.
I've tryed to override it with the following code:
UIManager.getDefaults().put("Button.contentMargins", new InsetsUIResource(0,0,0,0));
设置灵巧外观后,在main
中
.
in the main
, just after setting the nimbus look and feel.
但是什么也没发生,按钮文本周围的空白仍然很大. 有什么主意吗?
But nothing happens, the empty space around buttons text still remains large. Any idea?
推荐答案
更改JComponent.sizeVariant
的值也可能有效,如
Altering the value of the JComponent.sizeVariant
may also be effective, as discussed in Resizing a Component.
这篇关于JButton页边距.当雨云pl时不被尊重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!