Java examples for Swing:JTable Row
Selects the first row in a JTable.
//package com.java2s; import javax.swing.JTable; public class Main { /**//from ww w . jav a 2 s . c o m * Selects the first row in a table. This method is tolerant, it does * nothing if the given table is <code>null</code> or does not contain any * row. * * @param table * the table to select the first row from. */ public static void selectFirstRow(JTable table) { if (table != null && table.getRowCount() > 0) { table.getSelectionModel().setSelectionInterval(0, 0); } } }