001package jmri.jmrit.symbolicprog;
002
003import java.awt.Component;
004import javax.swing.JLabel;
005import javax.swing.JTable;
006import javax.swing.table.TableCellRenderer;
007
008/**
009 * Renders enum table cells.
010 *
011 * @author Bob Jacobsen Copyright (C) 2001
012 */
013public class ValueRenderer implements TableCellRenderer {
014
015    public ValueRenderer() {
016        super();
017    }
018
019    @Override
020    public Component getTableCellRendererComponent(JTable table, Object value,
021            boolean isSelected, boolean hasFocus,
022            int row, int column) {
023        // if (log.isDebugEnabled()) log.debug("getTableCellRendererComponent "
024        //       +" "+row+" "+column
025        //       +" "+isSelected+" "+hasFocus
026        //       +" "+value);
027        if (value instanceof Component) {
028            return (Component) value;
029        } else if (value instanceof String) {
030            return new JLabel((String) value);
031        } else {
032            return new JLabel("Unknown value type!");
033        }
034    }
035}