@Test public void testBuildAndShow() throws IOException { try { BeanTable<TestBean> bt = new BeanTable<>(TestBean.class, store, true, "header", "header\ntooltip", null); JFrame frame = new JFrame("Test BeanTable"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { try { bt.saveState(true); xstore.save(); System.exit(0); } catch (java.io.IOException ee) { ee.printStackTrace(); } } }); frame.getContentPane().add(bt); bt.setPreferredSize(new Dimension(500, 200)); frame.pack(); frame.setLocation(300, 300); frame.setVisible(true); } catch (HeadlessException e) { } }
public void saveState(boolean saveData) { if (store == null) return; try { if (saveData) { store.putBeanCollection("beanList", beans); } } catch (Exception e) { e.printStackTrace(); } List<PropertyCol> propCols = new ArrayList<>(); HidableTableColumnModel tableColumnModel = (HidableTableColumnModel) jtable.getColumnModel(); Enumeration<TableColumn> columns = tableColumnModel.getColumns(false); while (columns.hasMoreElements()) { PropertyCol propCol = new PropertyCol(); TableColumn column = columns.nextElement(); propCol.setName(column.getIdentifier().toString()); propCol.setWidth(column.getWidth()); propCol.setVisible(tableColumnModel.isColumnVisible(column)); propCols.add(propCol); } store.putBeanCollection("propertyCol", propCols); }
BeanTable extends JPanel { public void saveState(boolean saveData) { if (store == null) return; try { if (saveData) { store.putBeanCollection("beanList", beans); } } catch (Exception e) { e.printStackTrace(); } List<PropertyCol> propCols = new ArrayList<>(); HidableTableColumnModel tableColumnModel = (HidableTableColumnModel) jtable.getColumnModel(); Enumeration<TableColumn> columns = tableColumnModel.getColumns(false); while (columns.hasMoreElements()) { PropertyCol propCol = new PropertyCol(); TableColumn column = columns.nextElement(); propCol.setName(column.getIdentifier().toString()); propCol.setWidth(column.getWidth()); propCol.setVisible(tableColumnModel.isColumnVisible(column)); propCols.add(propCol); } store.putBeanCollection("propertyCol", propCols); } }
BeanTable extends JPanel { public void saveState(boolean saveData) { if (store == null) return; try { if (saveData) { store.putBeanCollection("beanList", beans); } } catch (Exception e) { e.printStackTrace(); } List<PropertyCol> propCols = new ArrayList<>(); HidableTableColumnModel tableColumnModel = (HidableTableColumnModel) jtable.getColumnModel(); Enumeration<TableColumn> columns = tableColumnModel.getColumns(false); while (columns.hasMoreElements()) { PropertyCol propCol = new PropertyCol(); TableColumn column = columns.nextElement(); propCol.setName(column.getIdentifier().toString()); propCol.setWidth(column.getWidth()); propCol.setVisible(tableColumnModel.isColumnVisible(column)); propCols.add(propCol); } store.putBeanCollection("propertyCol", propCols); } BeanTable(Class<T> bc, PreferencesExt pstore, boolean canAddDelete);  BeanTable(Class<T> bc, PreferencesExt pstore, String header, String tooltip, BeanInfo info);  BeanTable(Class<T> bc, PreferencesExt pstore, boolean canAddDelete, String header, String tooltip, T bean); }
BeanTable extends JPanel { public void saveState(boolean saveData) { if (store == null) return; try { if (saveData) { store.putBeanCollection("beanList", beans); } } catch (Exception e) { e.printStackTrace(); } List<PropertyCol> propCols = new ArrayList<>(); HidableTableColumnModel tableColumnModel = (HidableTableColumnModel) jtable.getColumnModel(); Enumeration<TableColumn> columns = tableColumnModel.getColumns(false); while (columns.hasMoreElements()) { PropertyCol propCol = new PropertyCol(); TableColumn column = columns.nextElement(); propCol.setName(column.getIdentifier().toString()); propCol.setWidth(column.getWidth()); propCol.setVisible(tableColumnModel.isColumnVisible(column)); propCols.add(propCol); } store.putBeanCollection("propertyCol", propCols); } BeanTable(Class<T> bc, PreferencesExt pstore, boolean canAddDelete);  BeanTable(Class<T> bc, PreferencesExt pstore, String header, String tooltip, BeanInfo info);  BeanTable(Class<T> bc, PreferencesExt pstore, boolean canAddDelete, String header, String tooltip, T bean); void setHeader(String header); String getToolTipText(MouseEvent event); void setProperty(String propertyName, String displayName, String toolTipText); void setPropertyEditable(String propertyName, boolean isHidden); void setPropertyHidden(String propertyName, boolean isHidden); void addListSelectionListener(ListSelectionListener l); void removeListSelectionListener(ListSelectionListener l); @Nullable T getSelectedBean(); List<T> getSelectedBeans(); ArrayList<Object> getSelectedCells(); void clearSelectedCells(); void addBean(T bean); void addBeans(List<T> newBeans); void setBeans(List<T> beans); void clearBeans(); List<T> getBeans(); JTable getJTable(); void setFontSize(int size); void setSelectionMode(int mode); void setSelectedBean(T bean); void clearSelection(); void setSelectedBeans(List<T> want); void refresh(); void setColumnSelectionAllowed(boolean b); void saveState(boolean saveData); void fireBeanDataChanged(T bean); }
BeanTable extends JPanel { public void saveState(boolean saveData) { if (store == null) return; try { if (saveData) { store.putBeanCollection("beanList", beans); } } catch (Exception e) { e.printStackTrace(); } List<PropertyCol> propCols = new ArrayList<>(); HidableTableColumnModel tableColumnModel = (HidableTableColumnModel) jtable.getColumnModel(); Enumeration<TableColumn> columns = tableColumnModel.getColumns(false); while (columns.hasMoreElements()) { PropertyCol propCol = new PropertyCol(); TableColumn column = columns.nextElement(); propCol.setName(column.getIdentifier().toString()); propCol.setWidth(column.getWidth()); propCol.setVisible(tableColumnModel.isColumnVisible(column)); propCols.add(propCol); } store.putBeanCollection("propertyCol", propCols); } BeanTable(Class<T> bc, PreferencesExt pstore, boolean canAddDelete);  BeanTable(Class<T> bc, PreferencesExt pstore, String header, String tooltip, BeanInfo info);  BeanTable(Class<T> bc, PreferencesExt pstore, boolean canAddDelete, String header, String tooltip, T bean); void setHeader(String header); String getToolTipText(MouseEvent event); void setProperty(String propertyName, String displayName, String toolTipText); void setPropertyEditable(String propertyName, boolean isHidden); void setPropertyHidden(String propertyName, boolean isHidden); void addListSelectionListener(ListSelectionListener l); void removeListSelectionListener(ListSelectionListener l); @Nullable T getSelectedBean(); List<T> getSelectedBeans(); ArrayList<Object> getSelectedCells(); void clearSelectedCells(); void addBean(T bean); void addBeans(List<T> newBeans); void setBeans(List<T> beans); void clearBeans(); List<T> getBeans(); JTable getJTable(); void setFontSize(int size); void setSelectionMode(int mode); void setSelectedBean(T bean); void clearSelection(); void setSelectedBeans(List<T> want); void refresh(); void setColumnSelectionAllowed(boolean b); void saveState(boolean saveData); void fireBeanDataChanged(T bean);  }