@@ -0,0 +1,1160 @@
+package hk.microos.tools;%0A%0Aimport javax.swing.DefaultListSelectionModel;%0Aimport javax.swing.JTable;%0Aimport javax.swing.ListSelectionModel;%0Aimport javax.swing.table.DefaultTableModel;%0Aimport javax.swing.table.TableColumn;%0A%0Apublic class TableHelper %7B%0A%09private JTable table;%0A%09public DefaultTableModel tm;%0A%09%0A%09public TableHelper(JTable table)%7B%0A%09%09this.table = table;%0A%09%09this.tm = (DefaultTableModel)table.getModel();%0A%09%09basicSettings();%0A%09%7D%0A%09private void basicSettings()%7B%0A%09%09//disable editing%0A%09%09this.table.setDefaultEditor(Object.class, null);%0A%09%09//disable dragging column%0A%09%09this.table.getTableHeader().setReorderingAllowed(false);%0A%09%09//disable multi-row selction%0A%09%09this.table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);%0A%09%09//this enable scroll panel scroll%0A%09%09this.table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);%0A%09%7D%0A%09public JTable getTable()%7B%0A%09%09return table;%0A%09%7D%0A%09public void setColSize(int %5B%5D colSize)%7B%0A%09%09if(table.getColumnCount() != colSize.length)%0A%09%09%09System.err.println(%22Unmatched colSize array and colNum!%22);%0A%09%09%0A%09%09for(int i=0;i%3CcolSize.length;i++)%7B%0A%09%09%09TableColumn tc = table.getColumnModel().getColumn(i);%0A%09%09%09tc.setPreferredWidth(colSize%5Bi%5D);%0A%09%09%7D%0A%09%09%0A%09%7D%0A%09%0A%0A%7D%0A

add TableHelper.java