Java JTable Data getSelectValue(JTable table, String columnName)

Here you can find the source of getSelectValue(JTable table, String columnName)

Description

get Select Value

License

Apache License

Declaration

public static String getSelectValue(JTable table, String columnName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.swing.JTable;

public class Main {

    public static String getSelectValue(JTable table, String columnName) {
        int row = table.getSelectedRow();
        if (row >= table.getModel().getRowCount())
            return null;
        if (row == -1)
            return null;
        int column = table.getColumn(columnName).getModelIndex();
        String id = (String) table.getValueAt(row, column);
        return id;
    }/* w  w  w  .  j  a  v  a  2 s. co m*/
}

Related

  1. findFirstRow(TableModel model, int col, String value)
  2. getRenderedComponent(JTable table, Object value, int row, int column)
  3. getRowByValue(TableModel model, int columnIndex, Object value)
  4. getRowIndex(JTable table, int column, String value)
  5. getSelectedValues(JTable table, int column)
  6. getStringValueAt(JTable table, int row, int columnIndex)
  7. getValueAt(JTable table, int row, String columnTitle)
  8. getValueBySelectedRow(JTable table, int rows[], int col)
  9. retrieveSelectedValuesFromTable(JTable table, int column)