Here you can find the source of getColumnOrder(final JTable table)
Parameter | Description |
---|---|
table | The table to get the column order from |
public static String getColumnOrder(final JTable table)
//package com.java2s; /*/* www . j ava 2 s . c o m*/ * jGnash, a personal finance application * Copyright (C) 2001-2017 Craig Cavanaugh * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import javax.swing.JTable; public class Main { /** * Returns the column order of a table in a formatted * {@code String}. * * @param table The table to get the column order from * @return A string in the format "0 1 2 3" */ public static String getColumnOrder(final JTable table) { StringBuilder buffer = new StringBuilder(); int count = table.getColumnCount(); for (int i = 0; i < count; i++) { if (i > 0) { buffer.append(' '); } buffer.append(table.convertColumnIndexToModel(i)); } return buffer.toString(); } }