/[xulu]/trunk/src/appl/util/NonEditableTableModel.java
ViewVC logotype

Contents of /trunk/src/appl/util/NonEditableTableModel.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Wed Feb 25 11:54:01 2009 UTC (15 years, 9 months ago) by mojays
File size: 947 byte(s)
First Commit, corresponds to Revision 1008 of Wikisquare-SVN 
1 package appl.util;
2
3 import javax.swing.table.DefaultTableModel;
4 import javax.swing.table.TableModel;
5
6 /**
7 * Simple {@link TableModel} that allows to specify columns which are not editable
8 *
9 * @author Dominik Appl
10 */
11 public class NonEditableTableModel extends DefaultTableModel {
12 private final boolean[] isEditable;
13
14 /**
15 * @param columnNames
16 * <code>array</code> containing the names of the new columns;
17 * if this is <code>null</code> then the model has no columns
18 *
19 * @param isEditable Specifies for each column if editable or not
20 *
21 * @param rowCount
22 * the number of rows the table holds
23 */
24 public NonEditableTableModel(Object[] columnNames, boolean[] isEditable,
25 int rowCount) {
26 super(columnNames, rowCount);
27 this.isEditable = isEditable;
28 }
29
30 @Override
31 public boolean isCellEditable(int row, int column) {
32 return isEditable[column];
33 }
34
35 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26