lead = model.getOrigin(lead);
switch(e.getKeyCode()) {
case KeyEvent.VK_DOWN : {
Dimension size = model.getSize(lead);
if(lead.row + size.height < model.getRowCount()) {
return model.getOrigin(new CellPosition(lead.row+size.height, lead.col));
}
break;
}
case KeyEvent.VK_UP : {
if(lead.row -1 >= 0) {
return model.getOrigin(new CellPosition(lead.row-1, lead.col));
}
break;
}
case KeyEvent.VK_RIGHT : {
Dimension size = model.getSize(lead);
if(lead.col + size.width < model.getColumnCount()) {
return model.getOrigin(new CellPosition(lead.row, lead.col+size.width));
}
break;
}
case KeyEvent.VK_LEFT : {
if(lead.col - 1 >= 0) {
return model.getOrigin(new CellPosition(lead.row, lead.col-1));
}
break;
}
}
return null;