01: package org.columba.calendar.ui.list;
02:
03: import java.awt.Component;
04:
05: import javax.swing.BorderFactory;
06: import javax.swing.JCheckBox;
07: import javax.swing.JTable;
08: import javax.swing.SwingUtilities;
09: import javax.swing.table.TableCellRenderer;
10:
11: import org.columba.calendar.base.api.ICalendarItem;
12:
13: //The contents of this file are subject to the Mozilla Public License Version 1.1
14: //(the "License"); you may not use this file except in compliance with the
15: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
16: //
17: //Software distributed under the License is distributed on an "AS IS" basis,
18: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19: //for the specific language governing rights and
20: //limitations under the License.
21: //
22: //The Original Code is "The Columba Project"
23: //
24: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
25: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
26: //
27: //All Rights Reserved.
28:
29: /**
30: *
31: *
32: * @author fdietz
33: */
34:
35: public class DefaultBooleanRenderer extends JCheckBox implements
36: TableCellRenderer {
37:
38: public DefaultBooleanRenderer() {
39:
40: //setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
41:
42: setHorizontalAlignment(SwingUtilities.CENTER);
43: }
44:
45: public Component getTableCellRendererComponent(JTable table,
46: Object value, boolean isSelected, boolean hasFocus,
47: int row, int column) {
48:
49: ICalendarItem item = (ICalendarItem) value;
50:
51: if (isSelected) {
52: setForeground(table.getSelectionForeground());
53: setBackground(table.getSelectionBackground());
54: } else {
55: setForeground(table.getForeground());
56: setBackground(table.getBackground());
57:
58: }
59:
60: //setBackground(item.getColor());
61:
62: setSelected(item.isSelected());
63:
64: return this;
65: }
66:
67: }
|