boolean (Object component, boolean outgo) { for (int i = 0; i < 2; i++) { // 0 is backward direction Object previous = getPreviousFocusable(component, null, true, false, (i == 0), outgo); if (previous != null) { setFocus(previous); return (i == 0); } } return false; }