void () { final int columns = myTable.getTable().getColumnCount(); final List<Integer> widths = new ArrayList<>(); final TableColumnModel columnModel = myTable.getTable().getColumnModel(); for (int i = 0; i < columns; i++) { widths.add(columnModel.getColumn(i).getWidth()); } // tree width comes last widths.add(myTable.getWidth() - myTable.getTable().getWidth()); myStateBean.myColumnSize = widths; final RowSorter<? extends TableModel> sorter = myTable.getTable().getRowSorter(); RowSorter.SortKey sortKey = null; if (sorter != null) { final List<? extends RowSorter.SortKey> keys = sorter.getSortKeys(); if (keys != null && !keys.isEmpty()) { sortKey = keys.get(0); } } if (sortKey != null && sortKey.getSortOrder() != SortOrder.UNSORTED) { myStateBean.mySortingColumn = sortKey.getColumn(); myStateBean.myAscendingOrder = sortKey.getSortOrder() == SortOrder.ASCENDING; } }