View Javadoc

1   package org.xmlhammer.gui.output;
2   
3   import javax.swing.Icon;
4   import javax.swing.ImageIcon;
5   import javax.swing.JLabel;
6   
7   import org.bounce.image.ImageLoader;
8   
9   public class CheckLabel extends JLabel {
10      private static final long serialVersionUID = 5113042624338810727L;
11      
12      private static final ImageIcon SELECTED_ICON = ImageLoader.get().getImage( "/org/xmlhammer/gui/icons/elcl16/enabled_co.gif");;
13      private static final ImageIcon ICON = ImageLoader.get().getImage( "/org/xmlhammer/gui/icons/elcl16/disabled_co.gif");;
14      
15      public CheckLabel() {
16          super();
17      }
18  
19      public CheckLabel(Icon icon, int i) {
20          super(icon, i);
21      }
22  
23      public CheckLabel(Icon icon) {
24          super(icon);
25      }
26  
27      public CheckLabel(String s, Icon icon, int i) {
28          super(s, icon, i);
29      }
30  
31      public CheckLabel(String s, int i) {
32          super(s, i);
33      }
34  
35      public CheckLabel(String s) {
36          super(s);
37      }
38  
39      public void setSelected(boolean selected) {
40          if (selected) {
41              setIcon(SELECTED_ICON);
42          } else {
43              setIcon(ICON);
44          }
45      }
46  }