72 |
} |
} |
73 |
|
|
74 |
/** |
/** |
75 |
|
* Stores the color set by setForeground(). |
76 |
|
*/ |
77 |
|
Color foreground; |
78 |
|
|
79 |
|
/** |
80 |
|
* Stores the color set by setBackground(). |
81 |
|
*/ |
82 |
|
Color background; |
83 |
|
|
84 |
|
/** |
85 |
* Creates a default table cell renderer with an empty border. |
* Creates a default table cell renderer with an empty border. |
86 |
*/ |
*/ |
87 |
public DefaultTableCellRenderer() |
public DefaultTableCellRenderer() |
97 |
public void setForeground(Color c) |
public void setForeground(Color c) |
98 |
{ |
{ |
99 |
super.setForeground(c); |
super.setForeground(c); |
100 |
|
foreground = c; |
101 |
} |
} |
102 |
|
|
103 |
/** |
/** |
108 |
public void setBackground(Color c) |
public void setBackground(Color c) |
109 |
{ |
{ |
110 |
super.setBackground(c); |
super.setBackground(c); |
111 |
|
background = c; |
112 |
} |
} |
113 |
|
|
114 |
/** |
/** |
158 |
} |
} |
159 |
else |
else |
160 |
{ |
{ |
161 |
setBackground(table.getBackground()); |
if (background != null) |
162 |
setForeground(table.getForeground()); |
setBackground(background); |
163 |
|
else |
164 |
|
setBackground(table.getBackground()); |
165 |
|
if (foreground != null) |
166 |
|
setForeground(foreground); |
167 |
|
else |
168 |
|
setForeground(table.getForeground()); |
169 |
} |
} |
170 |
|
|
171 |
if (hasFocus) |
if (hasFocus) |
172 |
{ |
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); |
|
if (!(getBackground() instanceof ColorUIResource)) |
|
|
setBackground(table.getBackground()); |
|
|
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); |
|
|
} |
|
173 |
else |
else |
174 |
setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
175 |
|
|