if (ke.getKeyChar() == KeyEvent.VK_TAB) {//TAB key ?
if (getModel().getRowCount() == (getSelectedRow() + 1)) {//last row ?
if (getSelectedColumn() == (getColumnCount() - 1)) {//last column ?
if (ke.getID() == KeyEvent.KEY_TYPED) {//shift-TAB ?
KeyboardFocusManager focusManager = KeyboardFocusManager
.getCurrentKeyboardFocusManager();
if (ke.isShiftDown()) {
focusManager.focusPreviousComponent();
} else {
//int selRow = getSelectedRow();
clearSelection();
focusManager.focusNextComponent();
}
}
} else {
setColumnSelectionInterval(getColumnCount() - 1, getColumnCount() - 1);
}
} else {
if (ke.isShiftDown()) {
KeyboardFocusManager focusManager = KeyboardFocusManager
.getCurrentKeyboardFocusManager();
if (getSelectedRow() == 0) {
if (getSelectedColumn() == 0) {
clearSelection();
focusManager.focusPreviousComponent();
} else {
setColumnSelectionInterval(
getColumnCount() - 1,
getColumnCount() - 1);
super.processKeyEvent(ke);