Java JTable Row getModelRowAtPoint(JTable table, Point point)

Here you can find the source of getModelRowAtPoint(JTable table, Point point)

Description

get Model Row At Point

License

Open Source License

Declaration

public static int getModelRowAtPoint(JTable table, Point point) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Point;

import javax.swing.JTable;

import javax.swing.RowSorter;

public class Main {
    public static int getModelRowAtPoint(JTable table, Point point) {
        int row = table.rowAtPoint(point);
        return rowToModelIndex(table, row);
    }/*from   w  w  w  .j  a v a2s.  c  o m*/

    public static int rowToModelIndex(JTable table, int row) {
        if (row >= 0) {
            RowSorter<?> rowSorter = table.getRowSorter();
            return rowSorter != null ? rowSorter
                    .convertRowIndexToModel(row) : row;
        }
        return -1;
    }
}

Related

  1. createDBXMLFile(JTable table, String docField, String rowField, Connection con, boolean reuseConnection, String driver, String dsn, String user, String password, String tableName, String whereString, String orderByString, String groupByString, boolean convertCharsToEntites)
  2. createThrowableMessage(Throwable t)
  3. deleteRows(final int[] sortedRows, final List list, final AbstractTableModel model)
  4. ensureRowCount(int count, JTable table)
  5. firstRowIsVoid(TableModel model)
  6. getNullRow(TableModel tm)
  7. getReadableRow(JTable table, int maximumHiddenPart)
  8. getRealRowPos(int rowPos, JTable table)
  9. getRowBounds(JTable table, int first, int last)