package com.connor.touliao;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableCellRenderer;

public class MyRenderer implements TableCellRenderer {
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
//		if (column != 1) {
			JTextField editor = new JTextField();
			editor.setHorizontalAlignment(JLabel.CENTER);
			if (value != null) {
				editor.setText(value.toString());
			}
//			editor.setBackground((row % 2 == 0) ? Color.white : Color.cyan);
			return editor;
//		} else {
//			JCheckBox editor = new JCheckBox();
//			editor.setEnabled(true);
//			editor.setHorizontalAlignment(JLabel.CENTER);
//			if (value instanceof Boolean) {
//				if ((Boolean) value == false) {
//					editor.setSelected(false);
//				} else if ((Boolean) value == false) {
//					editor.setSelected(true);
//				}
//			}
//			editor.setBackground((row % 2 == 0) ? Color.white : Color.cyan);
//			return editor;
//		}
	}
}
