aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin/guicustomization/ButtonTableCellRenderer.java
blob: 0bccc08e12de7bb654673e8532db56f57eb3d78d (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
44
45
46
/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 * 
 * Distributable under LGPL license. See terms of license at gnu.org.
 */
package net.java.sip.communicator.plugin.guicustomization;

import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;

/**
 * Custom <tt>TableCellRenderer</tt> that renders
 * <tt>ProtocolProviderService</tt> objects, <tt>MetaContactGroup</tt>
 * objects and JLabels.
 * 
 * @author Yana Stamcheva
 */
public class ButtonTableCellRenderer
    extends JPanel
    implements TableCellRenderer
{
    public ButtonTableCellRenderer()
    {
        super(new FlowLayout(FlowLayout.CENTER));

        this.setOpaque(true);
    }

    public Component getTableCellRendererComponent( JTable table,
                                                    Object value,
                                                    boolean isSelected,
                                                    boolean hasFocus,
                                                    int row,
                                                    int column)
    {
        this.removeAll();

        if(value instanceof JButton)
        {
            this.add((JButton) value);
        }

        return this;
    }
}