반응형
=================================
=================================
=================================
출처: http://matjazmuhic.wordpress.com/2011/04/20/jtable-disable-cell-editing/
In order to disable cell editing in JTable you have to implement your own table model and override “isCellEditable” method.
This sample show how to disable editing of all cells except for cells in second column:
01 |
public class CustomTableModel extends DefaultTableModel |
02 |
{ |
03 |
private static final long serialVersionUID = 1L; |
04 |
05 |
@Override |
06 |
public boolean isCellEditable( int row, int column) |
07 |
{ |
08 |
if (column == 1 ) |
09 |
{ |
10 |
return true ; |
11 |
} else |
12 |
{ |
13 |
return false ; |
14 |
} |
15 |
} |
16 |
} |
=================================
=================================
=================================
반응형
'JAVA > JAVA UI' 카테고리의 다른 글
JTabbedPane Component (0) | 2011.09.09 |
---|---|
JAVA - JTable 개인적으로 커스텀하기에 좋은 매소드 모음 (0) | 2011.09.07 |
java - JTable 메소드 (0) | 2011.09.06 |
자바 - swing JTable, JList 관련 (0) | 2011.09.06 |
자바 - SWT, Swing or AWT: 나에게 맞는 것 찾기 (0) | 2011.08.12 |