Exemplo n.º 1
0
  private Vector<String> getColumnNames() {
    Vector<String> columnNames = new Vector<String>();

    for (int i = 0; i < jTable1.getColumnCount(); i++) columnNames.add(jTable1.getColumnName(i));

    return columnNames;
  }
 private void saveColumnSpecification() {
   final TableColumnModel columnModel = table.getColumnModel();
   final int numColumns = table.getColumnCount();
   final List<String> columns = new ArrayList<String>(numColumns);
   final List<Integer> columnWidths = new ArrayList<Integer>(numColumns);
   for (int i = 0; i < numColumns; i++) {
     final String columnName = table.getColumnName(i);
     columns.add(columnName);
     final TableColumn column = columnModel.getColumn(i);
     final int columnWidth = column.getWidth();
     columnWidths.add(Integer.valueOf(columnWidth));
   }
   tableSpecification.setColumnOrder(columns);
   tableSpecification.setColumnWidths(columnWidths);
   MetricsProfileRepository.getInstance().persistCurrentProfile();
 }