4819544: SwingSet2 JTable Demo throws NullPointerException

Reviewed-by: pbansal, aivanov
This commit is contained in:
Prasanta Sadhukhan 2021-08-05 04:56:46 +00:00
parent 6c8441f075
commit 64d18d45ef

View File

@ -549,7 +549,10 @@ public class TableDemo extends DemoModule {
public int getRowCount() { return data.length;}
public Object getValueAt(int row, int col) {return data[row][col];}
public String getColumnName(int column) {return names[column];}
public Class<?> getColumnClass(int c) {return getValueAt(0, c).getClass();}
public Class<?> getColumnClass(int c) {
Object obj = getValueAt(0, c);
return obj != null ? obj.getClass() : Object.class;
}
public boolean isCellEditable(int row, int col) {return col != 5;}
public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; }
};