有没有办法改变jcheckbox使用十字架而不是勾? JAVA [英] is there a way to change jcheckbox to use a cross instead of a tick? JAVA

查看:107
本文介绍了有没有办法改变jcheckbox使用十字架而不是勾? JAVA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Jcheckbox,但它只有勾选显示已检查,有没有办法可以将它改为十字架或圆圈?
并且有没有办法将灰色背景更改为白色,setBackground似乎没有什么区别?

I have a Jcheckbox but it only has the tick to show its checked, is there a way i can change it to a cross, or circle? and is there a way to change the grey background to white the setBackground doesn't seem to make a difference?

推荐答案

用户setPressedIcon,setIcon和setDisabledIcon

User setPressedIcon, setIcon and setDisabledIcon

    JCheckBox b = new JCheckBox();
    b.setPressedIcon(pressedIcon)
    b.setIcon(defaultIcon);
    b.setDisabledIcon(disabledIcon)

这篇关于有没有办法改变jcheckbox使用十字架而不是勾? JAVA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆