Here you can find the source of moveSelectionDown(JTable table)
public static void moveSelectionDown(JTable table)
//package com.java2s; //License from project: Open Source License import javax.swing.JTable; public class Main { public static void moveSelectionDown(JTable table) { int selectedRow = table.getSelectedRow(); int selectedRowCount = table.getSelectedRowCount(); int rowCount = table.getRowCount(); int targetRow; if (rowCount == 0) { return; } else if (rowCount == 1) { targetRow = 0;//from w ww. j ava2 s . com } else { int bottomRow = selectedRowCount == 1 ? selectedRow : table .getSelectionModel().getMaxSelectionIndex(); if (bottomRow < rowCount - 1) { targetRow = bottomRow + 1; } else { targetRow = bottomRow; } } table.getSelectionModel() .setSelectionInterval(targetRow, targetRow); } }