Tutorial « JTable « Java Swing Q&A





2. Wanted: conceptual tutorial on JTable    coderanch.com

class MyTableColumnModel extends DefaultTableColumnModel { private TableModel tableModel; private TableColumn[] columns; private boolean[] visible; public MyTableColumnModel(TableModel tableModel) { this.tableModel = tableModel; int columnCount = tableModel.getColumnCount(); columns = new TableColumn[columnCount]; visible = new boolean[columnCount]; for (int i = 0; i < columnCount; i++) { columns[i] = new TableColumn(i); addColumn(columns[i]); visible[i] = true; } } public void showColumn(int modelIndex) { if (!visible[modelIndex]) { ...