Mega Code Archive

 
Categories / Java / Swing JFC
 

Customize these disabled icons

import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JCheckBox; public class Main {   public static void main(String[] argv) throws Exception {     JCheckBox checkbox = new JCheckBox();     // Set the unselected state icon     Icon unselDisIcon = new ImageIcon("nosel-dis-icon.gif");     checkbox.setDisabledIcon(unselDisIcon);     // Set the selected state icon     Icon selDisIcon = new ImageIcon("sel-dis-icon.gif");     checkbox.setDisabledSelectedIcon(selDisIcon);   } }