public void saveData() { TableUtil.stopEditing(myTable); final int count = myTable.getRowCount(); String[] urls = ArrayUtil.newStringArray(count); for (int row = 0; row < count; row++) { final TableItem item = ((MyTableModel) myTable.getModel()).getTableItemAt(row); urls[row] = item.getUrl(); } getModel().setRootUrls(AnnotationOrderRootType.getInstance(), urls); }
private static int columnMaxWidth(@NotNull JTable table, int col) { TableColumn column = table.getColumnModel().getColumn(col); int width = 0; for (int row = 0; row < table.getRowCount(); row++) { Component component = table.prepareRenderer(column.getCellRenderer(), row, col); int rendererWidth = component.getPreferredSize().width; width = Math.max(width, rendererWidth + table.getIntercellSpacing().width); } return width; }