简体   繁体   English

如何在实际复选框内更改J复选框的背景色

[英]how to change the background color of a J Checkbox inside the actual checkbox

How to change the color of the actual box of a JCheckBox ? 如何更改JCheckBox的实际框的颜色?

If I change the background color, it affects the color behind the text and checkbox, but not the color of the box itself. 如果更改背景颜色,它将影响文本和复选框后面的颜色,但不会影响框本身的颜色。

If I change the foreground color, only the text's color is affected. 如果更改前景色,则仅影响文本的颜色。

I can't find any other color properties. 我找不到其他颜色属性。

I just want a simple JCheckBox , with one color, which is changes when I check it. 我只想要一个具有一种颜色的简单JCheckBox ,当我检查它时它会改变。

I just want a simple JCheckBox, with 1 color, which is changeable when I check it. 我只想要一个具有1种颜色的简单JCheckBox,当我检查它时可以更改它。

There is no property you can set. 没有可以设置的属性。

You need to provide custom Icons for the check box: 您需要为复选框提供自定义图标:

checkBox.setIcon( new ImageIcon(...") );
checkBox.setSelectedIcon( new ImageIcon(...) );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM