blob: 302192ff6c840b8c9c8cba61a80e90e65c12e8a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package net.java.sip.communicator.plugin.guicustomization;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class LabelTableCellRenderer
extends JLabel
implements TableCellRenderer
{
public LabelTableCellRenderer()
{
this.setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
{
if (isSelected)
{
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
}
else
{
setBackground(table.getBackground());
setForeground(table.getForeground());
}
if (value instanceof JLabel)
{
JLabel labelValue = (JLabel) value;
this.setText(labelValue.getText());
this.setIcon(labelValue.getIcon());
this.setBackground(labelValue.getBackground());
}
setEnabled(table.isEnabled());
setFont(table.getFont());
return this;
}
}
|