简体   繁体   English

如何在不同背景颜色的列表中制作Swing Checkbox

[英]How to make Swing Checkbox in list with different background color

Lets start with saying Im not very knowledgeable with Swing. 让我们开始说我对Swing不是很了解。 But I have a regular JTable where I have various columns, some of which is Booleans which gets translated to checkboxes. 但是我有一个常规的JTable,我有各种各样的列,其中一些是Booleans,它被转换为复选框。 And as you can see in the image below, their background is pure white, and doesnt follow the "alternative" coloring as the other fields (Double and Strings). 正如你在下面的图片中看到的那样,它们的背景是纯白色,并且不像其他字段(Double和Strings)那样遵循“替代”着色。 Any clue on what is happening here is appreciated. 任何关于这里发生的事情的线索都表示赞赏。

具有仅白色背景的复选框的Swing应用程序示例

Thanks for the comments guys. 谢谢你的评论。 It led me straight right! 它让我直截了当! So I googled some custom renderer for Nimbus and checkboxes and found this which did exactly that I wanted. 所以我用谷歌搜索了一些Nimbus的自定义渲染器和复选框,发现这完全符合我的要求。

https://code.google.com/p/jsparklines/source/browse/trunk/src/main/java/no/uib/jsparklines/extra/NimbusCheckBoxRenderer.java?r=77 https://code.google.com/p/jsparklines/source/browse/trunk/src/main/java/no/uib/jsparklines/extra/NimbusCheckBoxRenderer.java?r=77

Thanks again 再次感谢

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

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