public UrlComboBox() { setToolTipText("URL"); setEditable(true); final JTextField editorComponent = (JTextField) getEditor().getEditorComponent(); editorComponent.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { editorComponent.selectAll(); } }); AutoCompletion ac = new AutoCompletion(this); ac.setStrict(false); ac.setStrictCompletion(false); }
/** * Sets the strict property. If true, it will not allow user to type in anything that is not in the known item list. * If false, user can type in whatever he/she wants. If the text can match with a item in the known item list, it * will still auto-complete. * * @param strict true or false. */ public void setStrict(boolean strict) { getAutoCompletion().setStrict(strict); }
public static AutoCompletion createAutoCompleteForText(JTextComponent txtBox, ListModel col) { SelectAllUtils.install(txtBox); AutoCompletion ac = new AutoCompletion(txtBox, new ListSearchable(new JList(col))); ac.setStrict(false); ac.setStrictCompletion(false); return ac; } }
public static AutoCompletion installSearchable(final JComboBox combo) { boolean wasEditable = combo.isEditable(); combo.setEditable(false); ComboBoxSearchable searchable = SearchableUtils.installSearchable(combo); searchable.setCaseSensitive(false); searchable.setWildcardEnabled(true); searchable.setCountMatch(true); searchable.setShowPopupDuringSearching(true); searchable.setRefreshPopupDuringSearching(true); AutoCompletion autoCompletion = new AutoCompletion(combo, searchable) { @Override protected AutoCompletionDocument createDocument() { return super.createDocument(); } }; autoCompletion.setStrict(false); autoCompletion.setStrictCompletion(false); autoCompletion.installListeners(); combo.setEditable(wasEditable); return autoCompletion; }
AutoCompletion autoCompletion = new AutoCompletion(treeTextField, searchable); setSearchableParams(searchable); autoCompletion.setStrict(false); autoCompletion.setStrictCompletion(false); searchable.setRecursive(true);