public void actionPerformed(ActionEvent e) { boolean state = ((Boolean) getValue(BAMutil.STATE)).booleanValue(); TableColumnModel tcm = table.getColumnModel(); if (state) { if (tc != null) tcm.addColumn(tc); } else hideColumn(); JTreeTableSorted.this.revalidate(); // System.out.println(id+" "+state); }
public void addAtPos(int pos) { if (tc == null) return; TableColumnModel tcm = table.getColumnModel(); // make sure it doesnt already exist try { tcm.addColumn(tc); int idx = tcm.getColumnIndex(id); tcm.moveColumn(idx, 0); } catch (Exception e) { System.out.println("addAtPos failed" + e); } }
private TableColumnModel getTableColumnModel() { TableColumnModel tcm = new DefaultTableColumnModel(); tcm.addColumn(genColumn(0, 100, "Word")); tcm.addColumn(genColumn(1, 400, "Clue")); return tcm; }