@Override public void hidePopup() { super.hidePopup(); _selectedIndex = -1; }
/** * Sets the fromStart property. * * @param fromStart true if the comparison matches from the start of the text only. Otherwise false. The difference * is if true, it will use String's <code>startWith</code> method to match. If false, it will use * <code>indedxOf</code> method. */ public void setFromStart(boolean fromStart) { hidePopup(); _fromStart = fromStart; }
@Override public void focusLost(FocusEvent focusevent) { boolean passive = _searchableProvider == null || _searchableProvider.isPassive(); if (passive) { hidePopup(); } } };
@Override public void componentHidden(ComponentEvent e) { super.componentHidden(e); boolean passive = _searchableProvider == null || _searchableProvider.isPassive(); if (passive) { hidePopup(); } }
/** * Uninstall the searchable that was installed to a component * * @param component the component that has a searchable installed. */ public static void uninstallSearchable(JComponent component) { if (component != null) { Object clientProperty = component.getClientProperty(Searchable.CLIENT_PROPERTY_SEARCHABLE); if (clientProperty instanceof Searchable) { Searchable searchable = ((Searchable) clientProperty); searchable.hidePopup(); searchable.uninstallListeners(); component.putClientProperty(Searchable.CLIENT_PROPERTY_SEARCHABLE, null); } } } }
@Override public void processKeyEvent(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_BACK_SPACE && getDocument().getLength() == 0) { e.consume(); return; } final boolean isNavigationKey = isNavigationKey(e); if (isDeactivateKey(e) && !isNavigationKey) { hidePopup(); if (keyCode == KeyEvent.VK_ESCAPE) e.consume(); return; } super.processKeyEvent(e); if (keyCode == KeyEvent.VK_BACK_SPACE || isNavigationKey) e.consume(); if (isSelectAllKey(e)) { e.consume(); } } }
/** * Uninstall the searchable that was installed to a component * * @param searchable the searchable. */ public static void uninstallSearchable(Searchable searchable) { if (searchable != null) { searchable.hidePopup(); searchable.uninstallListeners(); if (searchable.getComponent() instanceof JComponent) { Object clientProperty = ((JComponent) searchable.getComponent()).getClientProperty(Searchable.CLIENT_PROPERTY_SEARCHABLE); if (clientProperty == searchable) { ((JComponent) searchable.getComponent()).putClientProperty(Searchable.CLIENT_PROPERTY_SEARCHABLE, null); } } } }