Package org.jdesktop.swingx
Class JXSearchField
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.text.JTextComponent
-
- javax.swing.JTextField
-
- org.jdesktop.swingx.JXTextField
-
- org.jdesktop.swingx.JXSearchField
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible,javax.swing.Scrollable,javax.swing.SwingConstants
@JavaBean public class JXSearchField extends JXTextField
A text field with a find icon in which the user enters text that identifies items to search for. JXSearchField almost looks and behaves like a native Windows Vista search box, a Mac OS X search field, or a search field like the one used in Mozilla Thunderbird 2.0 - depending on the current look and feel. JXSearchField is a text field that contains a find button and a cancel button. The find button normally displays a lens icon appropriate for the current look and feel. The cancel button is used to clear the text and therefore only visible when text is present. It normally displays a 'x' like icon. Text can also be cleared, using the 'Esc' key. The position of the find and cancel buttons can be customized by either changing the search fields (text) margin or button margin, or by changing theJXSearchField.LayoutStyle. JXSearchField supports two different search modes:JXSearchField.SearchMode.INSTANTandJXSearchField.SearchMode.REGULAR. A search can be performed by registering anActionListener. TheActionEvents command property contains the text to search for. The search should be cancelled, when the command text is empty or null.- See Also:
RecentSearches, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classJXSearchField.ClearActionInvoked when the the cancel button or the 'Esc' key is pressed.classJXSearchField.FindActionInvoked when the find button is pressed.static classJXSearchField.LayoutStyleDefines, how the find and cancel button are layouted.static classJXSearchField.SearchModeDefines when action events are posted.-
Nested classes/interfaces inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
-
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private static javax.swing.KeyStrokeCANCEL_KEYThe key used to invoke the cancel action.private javax.swing.JButtoncancelButtonprivate static intDEFAULT_INSTANT_SEARCH_DELAYThe default instant search delay.private javax.swing.JButtonfindButtonprivate intinstantSearchDelayprivate javax.swing.TimerinstantSearchTimerprivate JXSearchField.LayoutStylelayoutStyleprivate booleanlayoutStyleSetprivate javax.swing.JButtonpopupButtonprivate booleanpromptFontStyleSetprivate RecentSearchesrecentSearchesprivate java.lang.StringrecentSearchesSaveKeyprivate JXSearchField.SearchModesearchModeprivate booleanuseSeperatePopupButtonprivate booleanuseSeperatePopupButtonSet-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description JXSearchField()Creates a new search field with a default prompt.JXSearchField(java.lang.String prompt)Creates a new search field with the given prompt andJXSearchField.SearchMode.INSTANT.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.JButtoncreateCancelButton()Creates and returns the cancel button.protected javax.swing.JButtoncreateFindButton()Creates and returns the find button.protected javax.swing.JButtoncreatePopupButton()Creates and returns the popup button.voidcustomSetUIProperty(java.lang.String propertyName, java.lang.Object value)Hack to enable the UI delegate to set default values depending on the current Look and Feel, without overriding custom values.voidcustomSetUIProperty(java.lang.String propertyName, java.lang.Object value, boolean override)Hack to enable the UI delegate to set default values depending on the current Look and Feel, without overriding custom values.java.awt.event.ActionListenergetCancelAction()Returns the cancel action, or an instance ofJXSearchField.ClearAction, if none has been set.javax.swing.JButtongetCancelButton()Returns the cancel button.java.awt.event.ActionListenergetFindAction()Returns the action that is invoked when the enter key is pressed or the find button is clicked.javax.swing.JButtongetFindButton()Returns the find button.javax.swing.JPopupMenugetFindPopupMenu()Returns the find popup menu.intgetInstantSearchDelay()Get the instant search delay in milliseconds.javax.swing.TimergetInstantSearchTimer()Returns theTimerused to delay the firing of action events in instant search mode when the user enters text.JXSearchField.LayoutStylegetLayoutStyle()Get the currentJXSearchField.LayoutStyle.javax.swing.JButtongetPopupButton()Returns the popup button.RecentSearchesgetRecentSearches()TODOjava.lang.StringgetRecentSearchesSaveKey()Returns the key used to persist recent searches.JXSearchField.SearchModegetSearchMode()Returns the currentJXSearchField.SearchMode.booleanhasFocus()Returnstrueif this search field is the focus owner or the find popup menu is visible.booleanisInstantSearchMode()booleanisMacLayoutStyle()booleanisManagingRecentSearches()TODObooleanisRegularSearchMode()booleanisUseNativeSearchFieldIfPossible()booleanisUseSeperatePopupButton()Returnstrueif the popup button should be visible and used for displaying the find popup menu.private booleanisValidRecentSearchesKey(java.lang.String key)booleanisVistaLayoutStyle()voidpostActionEvent()Overriden to prevent any delayedActionEvents from being sent after posting this action.voidsetCancelAction(java.awt.event.ActionListener cancelAction)Sets the action that is invoked, when the user presses the 'Esc' key or clicks the cancel button.voidsetEditable(boolean b)Updates the cancel, find and popup buttons enabled state in addition to setting the search fields editable state.voidsetEnabled(boolean enabled)Updates the cancel, find and popup buttons enabled state in addition to setting the search fields enabled state.voidsetFindAction(java.awt.event.ActionListener findAction)Sets the action that is invoked when the enter key is pressed or the find button is clicked.voidsetFindPopupMenu(javax.swing.JPopupMenu findPopupMenu)Sets the popup menu that will be displayed when the popup button is clicked.voidsetInstantSearchDelay(int instantSearchDelay)Set the instant search delay in milliseconds.voidsetLayoutStyle(JXSearchField.LayoutStyle layoutStyle)Set the currentJXSearchField.LayoutStyle.voidsetMargin(java.awt.Insets m)Set the margin space around the search field's text.voidsetPromptFontStyle(java.lang.Integer fontStyle)Hack to enable the UI delegate to set default values depending on the current Look and Feel, without overriding custom values.voidsetRecentSearchesSaveKey(java.lang.String recentSearchesSaveKey)Installs and manages a recent searches popup menu as the find popup menu, ifrecentSearchesSaveKeyis not null.voidsetSearchMode(JXSearchField.SearchMode searchMode)Sets the current search mode.voidsetUseNativeSearchFieldIfPossible(boolean useNativeSearchFieldIfPossible)voidsetUseSeperatePopupButton(boolean useSeperatePopupButton)Set if the popup button should be used for displaying the find popup menu.protected voidupdateButtonState()Enables the cancel action if this search field is editable and enabled, otherwise it will be disabled.voidupdateUI()Overriden to also update the find popup menu if set.-
Methods inherited from class org.jdesktop.swingx.JXTextField
addBuddy, addGap, getBuddies, getFocusBehavior, getOuterMargin, getPrompt, getPromptBackground, getPromptFontStyle, getPromptForeground, removeAllBuddies, setFocusBehavior, setOuterMargin, setPrompt, setPromptBackround, setPromptForeground
-
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
-
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, modelToView2D, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setFocusAccelerator, setHighlighter, setKeymap, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, viewToModel, viewToModel2D, write
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
DEFAULT_INSTANT_SEARCH_DELAY
private static final int DEFAULT_INSTANT_SEARCH_DELAY
The default instant search delay.- See Also:
- Constant Field Values
-
CANCEL_KEY
private static final javax.swing.KeyStroke CANCEL_KEY
The key used to invoke the cancel action.
-
findButton
private javax.swing.JButton findButton
-
cancelButton
private javax.swing.JButton cancelButton
-
popupButton
private javax.swing.JButton popupButton
-
layoutStyle
private JXSearchField.LayoutStyle layoutStyle
-
searchMode
private JXSearchField.SearchMode searchMode
-
useSeperatePopupButton
private boolean useSeperatePopupButton
-
useSeperatePopupButtonSet
private boolean useSeperatePopupButtonSet
-
layoutStyleSet
private boolean layoutStyleSet
-
instantSearchDelay
private int instantSearchDelay
-
promptFontStyleSet
private boolean promptFontStyleSet
-
instantSearchTimer
private javax.swing.Timer instantSearchTimer
-
recentSearchesSaveKey
private java.lang.String recentSearchesSaveKey
-
recentSearches
private RecentSearches recentSearches
-
-
Constructor Detail
-
JXSearchField
public JXSearchField()
Creates a new search field with a default prompt.
-
JXSearchField
public JXSearchField(java.lang.String prompt)
Creates a new search field with the given prompt andJXSearchField.SearchMode.INSTANT.- Parameters:
prompt-
-
-
Method Detail
-
getSearchMode
public JXSearchField.SearchMode getSearchMode()
Returns the currentJXSearchField.SearchMode.- Returns:
- the current
JXSearchField.SearchMode.
-
isInstantSearchMode
public boolean isInstantSearchMode()
- Returns:
trueif the currentJXSearchField.SearchModeisJXSearchField.SearchMode.INSTANT
-
isRegularSearchMode
public boolean isRegularSearchMode()
- Returns:
trueif the currentJXSearchField.SearchModeisJXSearchField.SearchMode.REGULAR
-
setSearchMode
public void setSearchMode(JXSearchField.SearchMode searchMode)
Sets the current search mode. SeeJXSearchField.SearchModefor a description of the different search modes.- Parameters:
searchMode-JXSearchField.SearchMode.INSTANTorJXSearchField.SearchMode.REGULAR
-
getInstantSearchDelay
public int getInstantSearchDelay()
Get the instant search delay in milliseconds. The default delay is 50 Milliseconds.- Returns:
- the instant search delay in milliseconds
-
setInstantSearchDelay
public void setInstantSearchDelay(int instantSearchDelay)
Set the instant search delay in milliseconds. InJXSearchField.SearchMode.INSTANT, when the user changes the text, an action event will be fired after the specified instant search delay. It is recommended to use a instant search delay to avoid the firing of unnecessary events. For example when the user replaces the whole text with a different text the search fields underlyingDocumenttypically fires 2 document events. The first one, because the old text is removed and the second one because the new text is inserted. If the instant search delay is 0, this would result in 2 action events being fired. When a instant search delay is used, the first document event typically is ignored, because the second one is fired before the delay is over, which results in a correct behavior because only the last and only relevant event will be delivered.- Parameters:
instantSearchDelay-
-
getLayoutStyle
public JXSearchField.LayoutStyle getLayoutStyle()
Get the currentJXSearchField.LayoutStyle.- Returns:
-
isVistaLayoutStyle
public boolean isVistaLayoutStyle()
- Returns:
-
isMacLayoutStyle
public boolean isMacLayoutStyle()
- Returns:
-
setLayoutStyle
public void setLayoutStyle(JXSearchField.LayoutStyle layoutStyle)
Set the currentJXSearchField.LayoutStyle. SeeJXSearchField.LayoutStylefor a description of how this affects layout and behavior of the search field.- Parameters:
layoutStyle-JXSearchField.LayoutStyle.MACorJXSearchField.LayoutStyle.VISTA
-
setMargin
public void setMargin(java.awt.Insets m)
Set the margin space around the search field's text.- Overrides:
setMarginin classjavax.swing.text.JTextComponent- See Also:
JTextComponent.setMargin(java.awt.Insets)
-
getCancelAction
public final java.awt.event.ActionListener getCancelAction()
Returns the cancel action, or an instance ofJXSearchField.ClearAction, if none has been set.- Returns:
- the cancel action
-
setCancelAction
public final void setCancelAction(java.awt.event.ActionListener cancelAction)
Sets the action that is invoked, when the user presses the 'Esc' key or clicks the cancel button.- Parameters:
cancelAction-
-
getCancelButton
public final javax.swing.JButton getCancelButton()
Returns the cancel button. CallscreateCancelButton()to create the cancel button and registers anActionListenerthat delegates actions to theActionListenerreturned bygetCancelAction(), if needed.- Returns:
- the cancel button
-
createCancelButton
protected javax.swing.JButton createCancelButton()
Creates and returns the cancel button. Override to use a custom cancel button.- Returns:
- the cancel button
- See Also:
getCancelButton()
-
getFindAction
public final java.awt.event.ActionListener getFindAction()
Returns the action that is invoked when the enter key is pressed or the find button is clicked. If no action has been set, a new instance ofJXSearchField.FindActionwill be returned.- Returns:
- the find action
-
setFindAction
public final void setFindAction(java.awt.event.ActionListener findAction)
Sets the action that is invoked when the enter key is pressed or the find button is clicked.
-
getFindButton
public final javax.swing.JButton getFindButton()
Returns the find button. CallscreateFindButton()to create the find button and registers anActionListenerthat delegates actions to theActionListenerreturned bygetFindAction(), if needed.- Returns:
- the find button
-
createFindButton
protected javax.swing.JButton createFindButton()
Creates and returns the find button. The buttons action is set to the action returned by#getSearchAction(). Override to use a custom find button.- Returns:
- the find button
- See Also:
getFindButton()
-
getPopupButton
public final javax.swing.JButton getPopupButton()
Returns the popup button. If a find popup menu is set, it will be displayed when this button is clicked. This button will only be visible, ifisUseSeperatePopupButton()returnstrue. Otherwise the popup menu will be displayed when the find button is clicked.- Returns:
- the popup button
-
createPopupButton
protected javax.swing.JButton createPopupButton()
Creates and returns the popup button. Override to use a custom popup button.- Returns:
- the popup button
- See Also:
getPopupButton()
-
isUseSeperatePopupButton
public boolean isUseSeperatePopupButton()
Returnstrueif the popup button should be visible and used for displaying the find popup menu. Otherwise, the find popup menu will be displayed when the find button is clicked.- Returns:
trueif the popup button should be used
-
setUseSeperatePopupButton
public void setUseSeperatePopupButton(boolean useSeperatePopupButton)
Set if the popup button should be used for displaying the find popup menu.- Parameters:
useSeperatePopupButton-
-
isUseNativeSearchFieldIfPossible
public boolean isUseNativeSearchFieldIfPossible()
-
setUseNativeSearchFieldIfPossible
public void setUseNativeSearchFieldIfPossible(boolean useNativeSearchFieldIfPossible)
-
setEditable
public void setEditable(boolean b)
Updates the cancel, find and popup buttons enabled state in addition to setting the search fields editable state.- Overrides:
setEditablein classjavax.swing.text.JTextComponent- See Also:
updateButtonState(),JTextComponent.setEditable(boolean)
-
setEnabled
public void setEnabled(boolean enabled)
Updates the cancel, find and popup buttons enabled state in addition to setting the search fields enabled state.- Overrides:
setEnabledin classjavax.swing.JComponent- See Also:
updateButtonState(),JComponent.setEnabled(boolean)
-
updateButtonState
protected void updateButtonState()
Enables the cancel action if this search field is editable and enabled, otherwise it will be disabled. Enabled the search action and popup button if this search field is enabled, otherwise it will be disabled.
-
setFindPopupMenu
public void setFindPopupMenu(javax.swing.JPopupMenu findPopupMenu)
Sets the popup menu that will be displayed when the popup button is clicked. If a find popup menu is set andisUseSeperatePopupButton()returnsfalse, the popup button will be displayed instead of the find button. Otherwise the popup button will be displayed in addition to the find button. The find popup menu is managed usingNativeSearchFieldSupportto achieve compatibility with the native search field support provided by the Mac Look And Feel since Mac OS 10.5. If a recent searches save key has been set and therefore a recent searches popup menu is installed, this method does nothing. You must first remove the recent searches save key, by callingsetRecentSearchesSaveKey(String)with anullparameter.- Parameters:
findPopupMenu- the popup menu, which will be displayed when the popup button is clicked- See Also:
setRecentSearchesSaveKey(String),RecentSearches
-
getFindPopupMenu
public javax.swing.JPopupMenu getFindPopupMenu()
Returns the find popup menu.- Returns:
- the find popup menu
- See Also:
setFindPopupMenu(JPopupMenu)
-
isManagingRecentSearches
public final boolean isManagingRecentSearches()
TODO- Returns:
-
isValidRecentSearchesKey
private boolean isValidRecentSearchesKey(java.lang.String key)
-
getRecentSearchesSaveKey
public java.lang.String getRecentSearchesSaveKey()
Returns the key used to persist recent searches.- Returns:
- See Also:
setRecentSearchesSaveKey(String)
-
setRecentSearchesSaveKey
public void setRecentSearchesSaveKey(java.lang.String recentSearchesSaveKey)
Installs and manages a recent searches popup menu as the find popup menu, ifrecentSearchesSaveKeyis not null. Otherwise, removes the popup menu and stops managing recent searches.- Parameters:
recentSearchesSaveKey- this key is used to persist the recent searches.- See Also:
setFindAction(ActionListener),isManagingRecentSearches(),RecentSearches
-
getRecentSearches
public RecentSearches getRecentSearches()
TODO- Returns:
-
getInstantSearchTimer
public javax.swing.Timer getInstantSearchTimer()
Returns theTimerused to delay the firing of action events in instant search mode when the user enters text. This timer callspostActionEvent().- Returns:
- the
Timerused to delay the firing of action events
-
hasFocus
public boolean hasFocus()
Returnstrueif this search field is the focus owner or the find popup menu is visible. This is a hack to make the search field paint the focus indicator in Mac OS X Aqua when the find popup menu is visible.- Overrides:
hasFocusin classjava.awt.Component- Returns:
trueif this search field is the focus owner or the find popup menu is visible
-
updateUI
public void updateUI()
Overriden to also update the find popup menu if set.- Overrides:
updateUIin classjavax.swing.text.JTextComponent
-
setPromptFontStyle
public void setPromptFontStyle(java.lang.Integer fontStyle)
Hack to enable the UI delegate to set default values depending on the current Look and Feel, without overriding custom values.- Overrides:
setPromptFontStylein classJXTextField- See Also:
PromptSupport.setFontStyle(Integer, javax.swing.text.JTextComponent)
-
customSetUIProperty
public void customSetUIProperty(java.lang.String propertyName, java.lang.Object value)Hack to enable the UI delegate to set default values depending on the current Look and Feel, without overriding custom values.- Parameters:
propertyName- the name of the property to changevalue- the new value of the property
-
customSetUIProperty
public void customSetUIProperty(java.lang.String propertyName, java.lang.Object value, boolean override)Hack to enable the UI delegate to set default values depending on the current Look and Feel, without overriding custom values.- Parameters:
propertyName- the name of the property to changevalue- the new value of the propertyoverride- override custom values
-
postActionEvent
public void postActionEvent()
Overriden to prevent any delayedActionEvents from being sent after posting this action. For example, if the currentJXSearchField.SearchModeisJXSearchField.SearchMode.INSTANTand the instant search delay is greater 0. The user enters some text and presses enter. This method will be invoked immediately because the users presses enter. However, this method would be invoked after the instant search delay, if we would not prevent it here.- Overrides:
postActionEventin classjavax.swing.JTextField
-
-