Here you can find the source of getColumnIndexFromName(TableModel tableModel, String columnToRemove)
Parameter | Description |
---|---|
tableModel | a parameter |
columnToRemove | a parameter |
public static int getColumnIndexFromName(TableModel tableModel, String columnToRemove)
//package com.java2s; //License from project: Open Source License import javax.swing.table.TableModel; public class Main { /**/* w ww . j a v a 2 s . c o m*/ * @param tableModel * @param columnToRemove * @return the index of the column, where the column name is the string */ public static int getColumnIndexFromName(TableModel tableModel, String columnToRemove) { for (int columnIndex = 0; columnIndex < tableModel.getColumnCount(); columnIndex++) { if (tableModel.getColumnName(columnIndex) .equals(columnToRemove)) { return columnIndex; } } return -1; } }