简体   繁体   中英

How to make the background of a JCheckBox transparent?

Is there an easy way to make the background of a JCheckBox transparent? The box itself and the text should both be ordinary colored.

setOpaque(false);

That line will make the background of the JCheckBox not be drawn. It will be the color of whatever Component it is on.

If you are subclassing a JCheckBox , just place that line in the constructor. Otherwise call it on an instance of the JCheckBox .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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