Changeset 192


Ignore:
Timestamp:
Feb 21, 2012, 10:55:03 PM (5 years ago)
Author:
tim.te.beek@…
Message:

Get the instance of DefaultTableCellHeaderRenderer? for table to render the base component, rather than extending it directly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/piqc-plugin/src/main/java/nl/nbic/brs/piqc/tableimport/panels/PreviewPanel.java

    r189 r192  
    2424import javax.swing.event.TableColumnModelEvent;
    2525import javax.swing.event.TableColumnModelListener;
     26import javax.swing.table.DefaultTableCellRenderer;
    2627import javax.swing.table.TableCellRenderer;
    2728import javax.swing.table.TableColumn;
    28 
    29 import sun.swing.table.DefaultTableCellHeaderRenderer;
    3029
    3130import nl.nbic.brs.piqc.tableimport.InterpretationDialog;
     
    181180}
    182181
    183 class CellHeaderRendererWithInterpretation extends DefaultTableCellHeaderRenderer {
     182class CellHeaderRendererWithInterpretation extends DefaultTableCellRenderer {
    184183        protected static final TableCellRenderer        INSTANCE        = new CellHeaderRendererWithInterpretation();
    185184
     
    197196
    198197                // Get component from super
    199                 Component superComponent = super.getTableCellRendererComponent(table, headerText, isSelected, hasFocus, row, column);
     198                TableCellRenderer renderer = table.getTableHeader().getDefaultRenderer();
     199                Component component = renderer.getTableCellRendererComponent(table, headerText, isSelected, hasFocus, row, column);
    200200
    201201                // Set background color for fun
    202202                if (columnClass == Boolean.class)
    203                         superComponent.setBackground(Color.green);
     203                        component.setBackground(Color.green);
    204204                else
    205205                        if (columnClass == Integer.class)
    206                                 superComponent.setBackground(Color.yellow);
     206                                component.setBackground(Color.yellow);
    207207                        else
    208208                                if (columnClass == Double.class)
    209                                         superComponent.setBackground(new Color(0, 192, 255));
    210 
    211                 return superComponent;
     209                                        component.setBackground(new Color(0, 192, 255));
     210
     211                return component;
    212212        }
    213213}
Note: See TracChangeset for help on using the changeset viewer.