Here you can find the source of getSelectValue(JTable table, String columnName)
public static String getSelectValue(JTable table, String columnName)
//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*/ }