001 // GraphLab Project: http://graphlab.sharif.edu 002 // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology 003 // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ 004 package graphlab.ui.components.gpropertyeditor.renderers; 005 006 import graphlab.ui.components.gpropertyeditor.GBasicCellRenderer; 007 008 import javax.swing.*; 009 import java.awt.*; 010 011 /** 012 * User: root 013 */ 014 public class GBooleanRenderer implements GBasicCellRenderer { 015 016 public Component getRendererComponent(Object value) { 017 Boolean b = (Boolean) value; 018 if (b) 019 return new JLabel("Yes"); 020 else 021 return new JLabel("No"); 022 // JCheckBox j = new JCheckBox("", b); 023 // j.setBorderPaintedFlat(true); 024 // j.setOpaque(false); 025 // j.setHorizontalAlignment(JCheckBox.CENTER); 026 // return j; 027 // String file; 028 // if ((Boolean) value == true) 029 // file = "true.gif"; 030 // else 031 // file = "false.gif"; 032 // JLabel l = new JLabel(new ImageIcon(getClass().getResource(file))); 033 // l.setLayout(new BorderLayout(2,2)); 034 // return l; 035 } 036 }