is there a way to change jcheckbox to use a cross instead of a tick? JAVA

瘦欲@ 提交于 2019-12-04 07:01:27

问题


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?


回答1:


User setPressedIcon, setIcon and setDisabledIcon

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


来源:https://stackoverflow.com/questions/4365069/is-there-a-way-to-change-jcheckbox-to-use-a-cross-instead-of-a-tick-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!