Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/jext/gui/DisabledCellRenderer.java


1   /*
2    * 15:50:41 18/03/00
3    *
4    * DisabledCellRenderer.java - Cell renderer for non-editable cells
5    * Copyright (C) 2000 Romain Guy
6    *
7    * This program is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation; either version 2
10   * of the License, or any later version.
11   *
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with this program; if not, write to the Free Software
19   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20   */
21  
22  package org.jext.gui;
23  
24  import java.awt.Component;
25  
26  import javax.swing.*;
27  import javax.swing.border.*;
28  import javax.swing.table.*;
29  
30  public class DisabledCellRenderer extends JLabel implements TableCellRenderer
31  {
32    public DisabledCellRenderer()
33    {
34      setOpaque(true);
35      setBorder(new EmptyBorder(1, 1, 1, 1));
36    }
37  
38    public Component getTableCellRendererComponent(JTable table, Object value,
39                                                   boolean isSelected, boolean cellHasFocus,
40                                                   int row, int col)
41    {
42      setBackground(table.getBackground());
43      setForeground(table.getForeground());
44      setText(value.toString());
45      return this;
46    }
47  }
48  
49  // End of DisabledCellRenderer.java