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 completion property. If true, in case insensitive searching, it will always use the exact item in * the Searchable to replace whatever user types. For example, when Searchable has an item "Arial" and user types in * "AR", if this flag is true, it will auto-completed as "Arial". If false, it will be auto-completed as "ARial". Of * course, this flag will only make a difference if Searchable is case insensitive. * * @param strictCompletion */ public void setStrictCompletion(boolean strictCompletion) { getAutoCompletion().setStrictCompletion(strictCompletion); }
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; } }
setSearchableParams(searchable); autoCompletion.setStrict(false); autoCompletion.setStrictCompletion(false); searchable.setRecursive(true); panel.add(Box.createVerticalStrut(1), JideBoxLayout.FIX);
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; }