package com.vci.client.ui.swing; import javax.swing.ImageIcon; import javax.swing.JLabel; import com.vci.client.ui.image.BundleImage; /** * * @author Administrator * */ public class CheckBoxLabel extends JLabel{ /** * */ private static final long serialVersionUID = 1L; public static class State { private State() { } } public static final State NOT_SELECTED = new State(); public static final State SELECTED = new State(); public static final State DONT_CARE = new State(); private static final ImageIcon selectIcon = new BundleImage().createImageIcon("checkBoxSelected.gif"); private static final ImageIcon unSelectIcon = new BundleImage().createImageIcon("checkBoxUnSelected.gif"); private static final ImageIcon partialSelectIcon = new BundleImage().createImageIcon("checkBoxPartialSelected.gif"); public CheckBoxLabel() { super(); try { this.setIcon(CheckBoxLabel.unSelectIcon); } catch (Exception e) { e.printStackTrace(); } } public void setState(State state) { if (state == NOT_SELECTED) { this.setIcon(unSelectIcon); } else if (state == SELECTED) { this.setIcon(selectIcon); } else { // either "null" or DONT_CARE this.setIcon(partialSelectIcon); } } }