if ( !e.getSource().equals( currentComponent ) ) {
if ( model != null ) {
int oldSelection = selectedRow;
int numChildren = model.getNumChildren();
int keyCode = e.getKeyCode();
ScrollPane sp = ( ( ScrollPane )getParent().getParent() );
int y = ( int )sp.getScrollPosition().y;
if ( ( keyCode == e.VK_UP ) || ( keyCode == VK_KP_UP ) ) {
selectedRow = Math.max( 0, selectedRow - 1 );
sp.setScrollPosition( 0, y - rowHeight );
}
else if ( ( keyCode == e.VK_DOWN ) || ( keyCode == VK_KP_DOWN ) ) {
selectedRow = Math.min( numChildren - 1, selectedRow + 1 );
sp.setScrollPosition( 0,
Math.min( y + rowHeight, ( ( numChildren - 2 ) * rowHeight ) ) );
}
else
return;