static A selectAllOnFocus(final A tc) { if (tc != null) onFocus(tc, r { awt { tc.selectAll() } }); // important to wait one AWT cycle ret tc; }