File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JCheckBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JCheckBox" Watch "JCheckBox" New topic


namal weheragoda

Joined: Aug 17, 2011
Posts: 13
anyone can help me to change the icon in check box..?

// jCheckBox1.setDisabledIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png"));
// jCheckBox1.setDisabledSelectedIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png"));
// jCheckBox1.setRolloverIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png"));
// jCheckBox1.setRolloverSelectedIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png"));

// jCheckBox1.setIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png"));

// jCheckBox1.setSelectedIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png") );
// jCheckBox1.setPressedIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png") );

i tried all this ways. but only

jCheckBox1.setIcon(new ImageIcon("E:\\TestTrials\\checkboxchecked.png"));

this method is working. others are not make change in the UI.

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> anyone can help me to change the icon in check box..?
> ... but only ... this method is working.

if it's working, do you still have a problem?
if so, try setting the icon in the JCheckBox constructor

I agree. Here's the link:
subject: JCheckBox
It's not a secret anymore!