1 package org.columba.calendar.ui.list; 2 3 import java.awt.Component ; 4 5 import javax.swing.BorderFactory ; 6 import javax.swing.JCheckBox ; 7 import javax.swing.JTable ; 8 import javax.swing.SwingUtilities ; 9 import javax.swing.table.TableCellRenderer ; 10 11 import org.columba.calendar.base.api.ICalendarItem; 12 13 29 34 35 public class DefaultBooleanRenderer extends JCheckBox implements 36 TableCellRenderer { 37 38 public DefaultBooleanRenderer() { 39 40 42 setHorizontalAlignment(SwingUtilities.CENTER); 43 } 44 45 public Component getTableCellRendererComponent(JTable table, Object value, 46 boolean isSelected, boolean hasFocus, int row, int column) { 47 48 ICalendarItem item = (ICalendarItem) value; 49 50 if (isSelected) { 51 setForeground(table.getSelectionForeground()); 52 setBackground(table.getSelectionBackground()); 53 } else { 54 setForeground(table.getForeground()); 55 setBackground(table.getBackground()); 56 57 } 58 59 61 setSelected(item.isSelected()); 62 63 return this; 64 } 65 66 } 67 | Popular Tags |