01: /*
02: * Copyright (C) 2005 Jeff Tassin
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.jeta.swingbuilder.gui.undo;
20:
21: import java.awt.Color;
22: import java.awt.Component;
23: import java.awt.Font;
24:
25: import javax.swing.JTable;
26: import javax.swing.UIManager;
27: import javax.swing.table.DefaultTableCellRenderer;
28:
29: public class FormEditsRenderer extends DefaultTableCellRenderer {
30: /**
31: * @directed
32: */
33: private int m_next_add_index;
34:
35: private Font m_font;
36:
37: private Color m_selbg;
38: private Color m_selfg;
39: private Color m_bg;
40: private Color m_fg;
41: private Color m_idx_bg = new Color(249, 199, 124);
42:
43: /**
44: * ctor
45: */
46: public FormEditsRenderer(int idx) {
47: m_next_add_index = idx;
48:
49: m_selbg = UIManager.getColor("Table.selectionBackground");
50: m_selfg = UIManager.getColor("Table.selectionForeground");
51: m_fg = UIManager.getColor("Table.foreground");
52: m_bg = UIManager.getColor("Table.background");
53: }
54:
55: /**
56: * TableCellRenderer implementation
57: */
58: public Component getTableCellRendererComponent(JTable table,
59: Object obj, boolean isSelected, boolean hasFocus, int row,
60: int col) {
61: Component result = super.getTableCellRendererComponent(table,
62: obj, isSelected, hasFocus, row, col);
63: if (row == m_next_add_index)
64: result.setBackground(m_idx_bg);
65: else
66: result.setBackground(m_bg);
67:
68: return result;
69: }
70:
71: }
|