void (final JTextField field, final TextRange selectionRange) { field.select(selectionRange.getStartOffset(), selectionRange.getEndOffset()); field.putClientProperty(DialogWrapperPeer.HAVE_INITIAL_SELECTION, true); }