ALMA Computing Group

MyCellRenderer.java

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * ALMA - Atacama Large Millimeter Array
00003  * Copyright (c) ESO - European Southern Observatory, 2011
00004  * (in the framework of the ALMA collaboration).
00005  * All rights reserved.
00006  * 
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  * 
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020  *******************************************************************************/
00021 package alma.demo.dyncomp;
00022 
00023 import java.awt.Component;
00024 import javax.swing.JButton;
00025 import javax.swing.JTable;
00026 import javax.swing.table.TableCellRenderer;
00027 
00032 class  MyCellRendererr extends JButton implements TableCellRenderer {
00033 
00036         public  MyCellRendererr() {
00037         }
00038 
00050         public Component getTableCellRendererComponent(
00051                         JTable table, 
00052                         Object value, 
00053                         boolean isSelected, 
00054                         boolean hasFocus, 
00055                         int row, 
00056                         int column) {
00057                 if (table.getValueAt(row,column)!=null) {
00058                         JButton btn = (JButton)value;
00059                         btn.setVisible(true);
00060                         return btn;
00061                 } else return null;
00062         }
00063         
00064 }
00065 
00066 
00067