| BooleanRenderer |

    1   /*
    2    *  Copyright (c) 1998-2001, The University of Sheffield.
    3    *
    4    *  This file is part of GATE (see http://gate.ac.uk/), and is free
    5    *  software, licenced under the GNU Library General Public License,
    6    *  Version 2, June 1991 (in the distribution as file licence.html,
    7    *  and also available at http://gate.ac.uk/gate/licence.html).
    8    *
    9    *  Valentin Tablan 23/01/2001
    10   *
    11   *  $Id: BooleanRenderer.java,v 1.4 2001/10/05 13:31:38 valyt Exp $
    12   *
    13   */
    14  package gate.gui;
    15
    16  import javax.swing.table.*;
    17  import javax.swing.*;
    18  import java.awt.*;
    19
    20  /**
    21   * A {@link javax.swing.table.TableCellRenderer} used for Booleans
    22   */
    23  public class BooleanRenderer extends DefaultTableCellRenderer {
    24    public Component getTableCellRendererComponent(JTable table,
    25                                                   Object value,
    26                                                   boolean isSelected,
    27                                                   boolean hasFocus,
    28                                                   int row,
    29                                                   int column){
    30      Component comp = super.getTableCellRendererComponent(table,
    31                                                           "",
    32                                                           isSelected, hasFocus,
    33                                                           row, column);
    34      if(value instanceof Boolean &&
    35         value != null &&
    36         ((Boolean)value).booleanValue()){
    37        setIcon(MainFrame.getIcon("tick.gif"));
    38  //      setIcon(MainFrame.getIcon((isSelected) ? "tick_white.gif" : "tick.gif"));
    39      } else {
    40        setIcon(null);
    41      }
    42
    43      return this;
    44    }//public Component getTableCellRendererComponent
    45  }//class BooleanRenderer extends DefaultTableCellRenderer

| BooleanRenderer |