01: package org.swingml.component;
02:
03: import java.util.*;
04:
05: import javax.swing.*;
06: import javax.swing.table.*;
07:
08: import org.swingml.model.*;
09: import org.swingml.model.TableColumnModel;
10:
11: /**
12: * @author Crosslogic
13: */
14: public class TableCellLabelDecorator {
15:
16: public TableCellLabelDecorator(JTableComponent aTable) {
17: super ();
18: JTableModel theTableModel = (JTableModel) aTable.getModel();
19: Iterator theColumns = theTableModel.getColumns().iterator();
20: TableColumnModel theColumn = null;
21: while (theColumns.hasNext()) {
22: theColumn = (TableColumnModel) theColumns.next();
23: TableCellRenderer originalRenderer = aTable
24: .getDefaultRenderer(theColumn.getType().getClass());
25: if (originalRenderer instanceof JLabel) {
26: aTable.setDefaultRenderer(theColumn.getType()
27: .getClass(), new TableCellLabelRenderer(
28: originalRenderer));
29: }
30: }
31: }
32: }
|