com.moneydance.awt
Class QuickSearchField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by com.moneydance.awt.QuickSearchField
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.border.Border, javax.swing.Scrollable, javax.swing.SwingConstants

public class QuickSearchField
extends javax.swing.JTextField
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, javax.swing.border.Border

QuickSearchField is a componet like the Cocoa NSSearchField. If the componet has no focus and no text form a user input, it shows the default text. If the user has entered any text, a cancel icon is shown. By clicking on the cancle icon the user input is reset to the default settings. You also can set a JPopupMenu that is show if the user clicks the search icon.

Author:
Christopher Atlan modified by Sean Reilly
See Also:
Serialized Form

Nested Class Summary
 
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
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String PROP_DEFAULT_SEARCH_COLOR
           
static java.lang.String PROP_DEFAULT_SEARCH_FONT
           
static java.lang.String PROP_DEFAULT_SEARCH_TEXT
           
static java.lang.String PROP_POPUP_MENU
           
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
QuickSearchField(java.awt.Color outerColor)
          Constructs a new QuickSearchField
QuickSearchField(javax.swing.Icon searchIcon, javax.swing.Icon cancelIcon)
          Constructs a new QuickSearchField initialized with the specified default text, search Icon and Cancel Icon
QuickSearchField(javax.swing.Icon searchIcon, javax.swing.Icon cancelIcon, javax.swing.JPopupMenu popupMenu, java.awt.Color outerColor)
          Constructs a new QuickSearchField initialized with the specified default text, search Icon, Cancel Icon and PopupMenu.
 
Method Summary
 java.awt.Insets getBorderInsets(java.awt.Component c)
           
 javax.swing.Icon getCancelIcon()
          Gets the cancel icon
 javax.swing.Icon getCancelIconPressed()
          Gets the pressed cancel icon
 java.lang.String getEmptyText()
          Gets the text that is displayed when there is no input in the field.
 java.awt.Dimension getMinimumSize()
           
 javax.swing.JPopupMenu getPopupMenu()
          Gets the JPopupMenu, this is show if the user clicks on the searchIcon
 java.awt.Dimension getPreferredSize()
           
 javax.swing.Icon getSearchIcon()
          Gets the search icon
 javax.swing.Icon getSearchIconPressed()
          Gets the pressed search icon
 boolean isBorderOpaque()
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
           
 void paintComponent(java.awt.Graphics g)
           
 void setCancelIcon(javax.swing.Icon value)
          Sets a cancel icon
 void setCancelIconPressed(javax.swing.Icon value)
          Sets a pressed cancel icon
 void setEmptyText(java.lang.String newEmptyText)
          Sets the default text, this text is shown if the component has no focus and the user has not entered any text.
 void setPopupMenu(javax.swing.JPopupMenu value)
          Sets a JPopupMenu, this is show if the user clicks on the searchIcon
 void setSearchIcon(javax.swing.Icon value)
          Sets a search icon
 void setSearchIconPressed(javax.swing.Icon value)
          Sets a pressed search icon
 java.lang.String toString()
           
 
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, 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, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, 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, setEnabled, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_DEFAULT_SEARCH_TEXT

public static final java.lang.String PROP_DEFAULT_SEARCH_TEXT
See Also:
Constant Field Values

PROP_DEFAULT_SEARCH_FONT

public static final java.lang.String PROP_DEFAULT_SEARCH_FONT
See Also:
Constant Field Values

PROP_DEFAULT_SEARCH_COLOR

public static final java.lang.String PROP_DEFAULT_SEARCH_COLOR
See Also:
Constant Field Values

PROP_POPUP_MENU

public static final java.lang.String PROP_POPUP_MENU
See Also:
Constant Field Values
Constructor Detail

QuickSearchField

public QuickSearchField(java.awt.Color outerColor)
Constructs a new QuickSearchField


QuickSearchField

public QuickSearchField(javax.swing.Icon searchIcon,
                        javax.swing.Icon cancelIcon)
Constructs a new QuickSearchField initialized with the specified default text, search Icon and Cancel Icon


QuickSearchField

public QuickSearchField(javax.swing.Icon searchIcon,
                        javax.swing.Icon cancelIcon,
                        javax.swing.JPopupMenu popupMenu,
                        java.awt.Color outerColor)
Constructs a new QuickSearchField initialized with the specified default text, search Icon, Cancel Icon and PopupMenu.

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

getEmptyText

public java.lang.String getEmptyText()
Gets the text that is displayed when there is no input in the field.


setEmptyText

public void setEmptyText(java.lang.String newEmptyText)
Sets the default text, this text is shown if the component has no focus and the user has not entered any text.


getPopupMenu

public javax.swing.JPopupMenu getPopupMenu()
Gets the JPopupMenu, this is show if the user clicks on the searchIcon


setPopupMenu

public void setPopupMenu(javax.swing.JPopupMenu value)
Sets a JPopupMenu, this is show if the user clicks on the searchIcon


getSearchIcon

public javax.swing.Icon getSearchIcon()
Gets the search icon


setSearchIcon

public void setSearchIcon(javax.swing.Icon value)
Sets a search icon


getCancelIcon

public javax.swing.Icon getCancelIcon()
Gets the cancel icon


setCancelIcon

public void setCancelIcon(javax.swing.Icon value)
Sets a cancel icon


getSearchIconPressed

public javax.swing.Icon getSearchIconPressed()
Gets the pressed search icon


setSearchIconPressed

public void setSearchIconPressed(javax.swing.Icon value)
Sets a pressed search icon


getCancelIconPressed

public javax.swing.Icon getCancelIconPressed()
Gets the pressed cancel icon


setCancelIconPressed

public void setCancelIconPressed(javax.swing.Icon value)
Sets a pressed cancel icon


getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JTextField

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Specified by:
getBorderInsets in interface javax.swing.border.Border

isBorderOpaque

public boolean isBorderOpaque()
Specified by:
isBorderOpaque in interface javax.swing.border.Border

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Specified by:
paintBorder in interface javax.swing.border.Border

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener