1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package fulmine.ui.field;
17
18 import static fulmine.util.Utils.EMPTY_STRING;
19
20 import java.awt.Component;
21
22 import javax.swing.JCheckBox;
23 import javax.swing.JTable;
24
25
26
27
28
29
30 public class JCheckBoxUI extends AbstractFieldUI
31 {
32 private static final long serialVersionUID = 1L;
33
34
35 private final JCheckBox renderer;
36
37
38 private final JCheckBox editor;
39
40 public JCheckBoxUI()
41 {
42 this.renderer = new JCheckBox();
43 this.renderer.setOpaque(true);
44 this.editor = new JCheckBox();
45 this.editor.setOpaque(true);
46 }
47
48 public Component getTableCellEditorComponent(JTable table, Object value,
49 boolean isSelected, int row, int column)
50 {
51 this.editor.setSelected(Boolean.parseBoolean(EMPTY_STRING + value));
52 return this.editor;
53 }
54
55 public Object getCellEditorValue()
56 {
57 return new Boolean(this.editor.isSelected());
58 }
59
60 public Component getTableCellRendererComponent(JTable table, Object value,
61 boolean isSelected, boolean hasFocus, int row, int column)
62 {
63 this.renderer.setSelected(Boolean.parseBoolean(EMPTY_STRING + value));
64 return this.renderer;
65 }
66 }