final int TEXT_FIELD_SIZE = 12; final JTextField jtf_key = new JTextField(TEXT_FIELD_SIZE); if(!keys.isEmpty()) {AutoCompleteDecorator.decorate(jtf_key, keys, false);} final JTextField jtf_value = new JTextField(TEXT_FIELD_SIZE); jl_key.setDisplayedMnemonic('k');
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given <tt>List</tt>. * @param textComponent the text component that will be used for automatic * completion. * @param items contains the items that are used for autocompletion * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered */ public static void decorate(JTextComponent textComponent, List<?> items, boolean strictMatching) { decorate(textComponent, items, strictMatching, null); }
/** * Ajout l'auto-complétion sur une liste déroulante, en utilisant le * converteur donné pour afficher les données. * * @param combo la combo à décorer * @param convertor le converter utilisé pour afficher les données. */ public static void decorate(JComboBox combo, ObjectToStringConverter convertor) { org.jdesktop.swingx.autocomplete.AutoCompleteDecorator.decorate(combo, convertor); }
/** * Enables automatic completion for the given JComboBox. The automatic * completion will be strict (only items from the combo box can be selected) * if the combo box is not editable. * @param comboBox a combo box * @see #decorate(JComboBox, ObjectToStringConverter) */ public static void decorate(JComboBox comboBox) { decorate(comboBox, null); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given JList. The two components will be * synchronized. The automatic completion will always be strict. * @param list a <tt>JList</tt> containing the items for automatic completion * @param textComponent the text component that will be enabled for automatic * completion */ public static void decorate(JList list, JTextComponent textComponent) { decorate(list, textComponent, null); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given <tt>List</tt>. * @param textComponent the text component that will be used for automatic * completion. * @param items contains the items that are used for autocompletion * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered */ public static void decorate(JTextComponent textComponent, List<?> items, boolean strictMatching) { decorate(textComponent, items, strictMatching, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given JList. The two components will be * synchronized. The automatic completion will always be strict. * @param list a <tt>JList</tt> containing the items for automatic completion * @param textComponent the text component that will be enabled for automatic * completion */ public static void decorate(JList list, JTextComponent textComponent) { decorate(list, textComponent, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); }
/** * Enables automatic completion for the given JComboBox. The automatic * completion will be strict (only items from the combo box can be selected) * if the combo box is not editable. * @param comboBox a combo box * @see #decorate(JComboBox, ObjectToStringConverter) */ public static void decorate(final JComboBox comboBox) { decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given <tt>List</tt>. * @param textComponent the text component that will be used for automatic * completion. * @param items contains the items that are used for autocompletion * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered */ public static void decorate(JTextComponent textComponent, List<?> items, boolean strictMatching) { decorate(textComponent, items, strictMatching, null); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given JList. The two components will be * synchronized. The automatic completion will always be strict. * @param list a <tt>JList</tt> containing the items for automatic completion * @param textComponent the text component that will be enabled for automatic * completion */ public static void decorate(JList list, JTextComponent textComponent) { decorate(list, textComponent, null); }
/** * Enables automatic completion for the given JComboBox. The automatic * completion will be strict (only items from the combo box can be selected) * if the combo box is not editable. * @param comboBox a combo box * @see #decorate(JComboBox, ObjectToStringConverter) */ public static void decorate(JComboBox comboBox) { decorate(comboBox, null); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given <tt>List</tt>. * @param items contains the items that are used for autocompletion * @param textComponent the text component that will be used for automatic * completion. * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered * @param stringConverter the converter used to transform items to strings */ public static void decorate(JTextComponent textComponent, List<?> items, boolean strictMatching, ObjectToStringConverter stringConverter) { AbstractAutoCompleteAdaptor adaptor = new TextComponentAdaptor(textComponent, items); AutoCompleteDocument document = createAutoCompleteDocument(adaptor, strictMatching, stringConverter, textComponent.getDocument()); decorate(textComponent, document, adaptor); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given <tt>List</tt>. * @param items contains the items that are used for autocompletion * @param textComponent the text component that will be used for automatic * completion. * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered * @param stringConverter the converter used to transform items to strings */ public static void decorate(JTextComponent textComponent, List<?> items, boolean strictMatching, ObjectToStringConverter stringConverter) { AbstractAutoCompleteAdaptor adaptor = new TextComponentAdaptor(textComponent, items); AutoCompleteDocument document = createAutoCompleteDocument(adaptor, strictMatching, stringConverter, textComponent.getDocument()); decorate(textComponent, document, adaptor); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given JList. The two components will be * synchronized. The automatic completion will always be strict. * @param list a <tt>JList</tt> containing the items for automatic completion * @param textComponent the text component that will be used for automatic * completion * @param stringConverter the converter used to transform items to strings */ public static void decorate(JList list, JTextComponent textComponent, ObjectToStringConverter stringConverter) { AbstractAutoCompleteAdaptor adaptor = new ListAdaptor(list, textComponent, stringConverter); AutoCompleteDocument document = createAutoCompleteDocument(adaptor, true, stringConverter, textComponent.getDocument()); decorate(textComponent, document, adaptor); }
public static <T> JComboBox createGenericComboBox(List<T> list, GenericObjectToString<T> os, boolean autoComplete, T nullObject) { List<T> l = list; if (nullObject != null) { l = createListWithNull(list, nullObject); } JComboBox comboBox = new JComboBox(l.toArray()); comboBox.setRenderer(new TypeGenericCellRenderer<T>(os, nullObject)); if (autoComplete) { // comboBox.setEditable(true); AutoCompleteDecorator.decorate(comboBox, new GenericObjectToStringConverter<T>(os, nullObject)); } return comboBox; }
protected void initComponents() { comparaisonTypeBox = new JComboBox(new String[] { SwingMessages.getString("StringFilterColumn.28"), //$NON-NLS-1$ SwingMessages.getString("StringFilterColumn.29"), SwingMessages.getString("StringFilterColumn.30"), SwingMessages.getString("StringFilterColumn.31") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ comparaisonTypeBox.addActionListener(new ContainsActionListener()); textField = new JTextField(); textField.addActionListener(new TextActionListener()); textField.addFocusListener(new TextFocusListener()); AbstractAutoCompleteAdaptor adaptor = new MyAutoCompleteAdaptor(); AutoCompleteDocument document = new AutoCompleteDocument(adaptor, false); textField.setDocument(document); AutoCompleteDecorator.decorate(textField, document, adaptor); }
public static <T> JComboBox createGenericComboBox(ValueModel valueModel, List<T> list, GenericObjectToString<T> os, boolean autoComplete, T nullObject) { List<T> l = list; if (nullObject != null) { l = createListWithNull(list, nullObject); } SelectionInList<T> selectionInList = new SelectionInList<T>(l, valueModel); JComboBox comboBox = BasicComponentFactory.createComboBox(selectionInList, new TypeGenericCellRenderer<T>(os, nullObject)); if (autoComplete) { // comboBox.setEditable(true); AutoCompleteDecorator.decorate(comboBox, new GenericObjectToStringConverter<T>(os, nullObject)); } return comboBox; }
/** * Ajout l'auto-complétion sur une liste déroulante, en utilisant le * converteur donné pour afficher les données. * * @param combo la combo à décorer * @param convertor le converter utilisé pour afficher les données. */ public static void decorate(JComboBox combo, ObjectToStringConverter convertor) { // tchemit 2010-10-05 since swingx 1.6.2, undecorate stuff is no more // public and we want to use it, so hack it... combo.putClientProperty("oldEditor", combo.getEditor()); combo.putClientProperty("oldDocument", combo.getEditor().getEditorComponent()); AutoCompleteDecorator.decorate(combo, convertor); }
protected void initComponents() { comparaisonTypeBox = new JComboBox(new String[] { SwingMessages.getString("NumberFilterColumn.0"), //$NON-NLS-1$ SwingMessages.getString("NumberFilterColumn.1"), SwingMessages.getString("NumberFilterColumn.2"), SwingMessages.getString("NumberFilterColumn.3"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ SwingMessages.getString("NumberFilterColumn.4"), SwingMessages.getString("NumberFilterColumn.5"), SwingMessages.getString("NumberFilterColumn.6"), SwingMessages.getString("NumberFilterColumn.7") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ comparaisonTypeBox.addActionListener(new ContainsActionListener()); textField = new JTextField(); textField.addActionListener(new TextActionListener()); textField.addFocusListener(new TextFocusListener()); AbstractAutoCompleteAdaptor adaptor = new MyAutoCompleteAdaptor(); AutoCompleteDocument document = new AutoCompleteDocument(adaptor, false); textField.setDocument(document); AutoCompleteDecorator.decorate(textField, document, adaptor); }