1 package org.wcb.common; 2 3 import javax.swing.table.AbstractTableModel; 4 5 /*** 6 * Copyright (C) 2003 Walter Bogaardt 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21 * 22 * Project: Home Automation Interface 23 * 24 * Abstract: User Interface options dialog box 25 * Filename: $Id: FontTableModel.java,v 1.3 2004/07/22 03:06:50 wbogaardt Exp $ 26 * 27 * * $Log: FontTableModel.java,v $ 28 * * Revision 1.3 2004/07/22 03:06:50 wbogaardt 29 * * removed deprecated method calls. 30 * * 31 * * Revision 1.2 2003/12/30 22:15:59 wbogaardt 32 * * added javadoc comments 33 * * 34 */ 35 public class FontTableModel extends AbstractTableModel { 36 final String[] columnNames = {"Description", "Font"}; 37 38 private static Object[][] uiFonts; 39 40 public FontTableModel(Object[][] fonts) 41 { 42 uiFonts = fonts; 43 } 44 45 public int getColumnCount() { 46 return columnNames.length; 47 } 48 49 public int getRowCount() { 50 return uiFonts.length; 51 } 52 53 public String getColumnName(int col) { 54 return columnNames[col]; 55 } 56 57 public Object getValueAt(int row, int col) { 58 return uiFonts[row][col]; 59 } 60 61 public void setValueAt(Object value, int row, int col) { 62 uiFonts[row][col] = value; 63 fireTableCellUpdated(row, col); 64 } 65 66 /*** 67 * JTable uses this method to determine the default renderer/ 68 * editor for each cell. 69 */ 70 public Class getColumnClass(int c) { 71 return getValueAt(0, c).getClass(); 72 } 73 74 public boolean isCellEditable(int row, int col) { 75 if (col < 1) return false; 76 else return true; 77 } 78 }