50 |
import javax.swing.border.Border; |
import javax.swing.border.Border; |
51 |
import javax.swing.border.EmptyBorder; |
import javax.swing.border.EmptyBorder; |
52 |
import javax.swing.JTextField; |
import javax.swing.JTextField; |
|
import javax.swing.plaf.ColorUIResource; |
|
53 |
|
|
54 |
/** |
/** |
55 |
* Class to display every cells. |
* Class to display every cells. |
119 |
public void updateUI() |
public void updateUI() |
120 |
{ |
{ |
121 |
super.updateUI(); |
super.updateUI(); |
122 |
|
background = null; |
123 |
|
foreground = null; |
124 |
} |
} |
125 |
|
|
126 |
/** |
/** |
172 |
if (hasFocus) |
if (hasFocus) |
173 |
{ |
{ |
174 |
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); |
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); |
175 |
super.setBackground(UIManager.getColor("Table.focusCellBackground")); |
if (table.isCellEditable(row, column)) |
176 |
super.setForeground(UIManager.getColor("Table.focusCellForeground")); |
{ |
177 |
|
super.setBackground(UIManager.getColor("Table.focusCellBackground")); |
178 |
|
super.setForeground(UIManager.getColor("Table.focusCellForeground")); |
179 |
|
} |
180 |
} |
} |
181 |
else |
else |
182 |
setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
184 |
setEnabled(table.isEnabled()); |
setEnabled(table.isEnabled()); |
185 |
setFont(table.getFont()); |
setFont(table.getFont()); |
186 |
|
|
187 |
|
// If the current background is equal to the table's background, then we |
188 |
|
// can avoid filling the background by setting the renderer opaque. |
189 |
|
Color back = getBackground(); |
190 |
|
setOpaque(back != null && back.equals(table.getBackground())); |
191 |
|
|
192 |
return this; |
return this; |
193 |
} |
} |
194 |
|
|