- java.lang.Object
-
- javax.swing.AbstractAction
-
- util.ui.findasyoutype.FindAction
-
- util.ui.findasyoutype.TextComponentFindAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.ComponentListener
,java.awt.event.FocusListener
,java.awt.event.KeyListener
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Runnable
,java.util.EventListener
,javax.swing.Action
,javax.swing.event.DocumentListener
public class TextComponentFindAction extends FindAction implements java.awt.event.FocusListener, java.awt.event.ComponentListener
This TextComponentFindAction is based on the Implementation of Santosh For Details look here: http://jroller.com/page/santhosh/20050707#incremental_search_jtextcomponent- Author:
- Santhosh Changed for support of a search bar instead of a search popup by René Mach: - added the needed components for the search bar - added ComponentListener to initialize the search when the search bar becomes visible - added Runnable to support closing the search bar automatically if the search was started with a key type. - added Localizer - added MouseAdapter for the search bar buttons
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class util.ui.findasyoutype.FindAction
controlDown, metaDown, shiftDown
-
-
Constructor Summary
Constructors Constructor Description TextComponentFindAction(javax.swing.text.JTextComponent comp)
TextComponentFindAction(javax.swing.text.JTextComponent comp, boolean startAtKeyType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
changed(javax.swing.JComponent comp, java.lang.String str, javax.swing.text.Position.Bias bias)
void
componentHidden(java.awt.event.ComponentEvent e)
void
componentMoved(java.awt.event.ComponentEvent e)
void
componentResized(java.awt.event.ComponentEvent e)
void
componentShown(java.awt.event.ComponentEvent e)
void
focusGained(java.awt.event.FocusEvent e)
void
focusLost(java.awt.event.FocusEvent e)
javax.swing.JButton
getCloseButton()
protected int
getNextMatch(javax.swing.text.JTextComponent textComp, java.lang.String str, int startingOffset, javax.swing.text.Position.Bias bias)
javax.swing.JPanel
getSearchBar()
javax.swing.text.JTextComponent
getTextComponent()
protected void
initSearch(java.awt.event.ActionEvent ae)
void
interrupt()
Interrupts the closing Thread.boolean
isAlwaysVisible()
void
run()
Waits for closing of the panel.void
showSearchBar()
Shows the search bar-
Methods inherited from class util.ui.findasyoutype.FindAction
actionPerformed, changedUpdate, getComponent, getMessageLabel, getSearchField, getThread, getWaitTime, insertUpdate, installKeyListener, isBlockAutoClosing, isIgnoreCase, keyPressed, keyReleased, keyTyped, next, prev, removeUpdate, reset, setBlockAutoClosing, setIgnoreCase, setWaitTime
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Method Detail
-
initSearch
protected void initSearch(java.awt.event.ActionEvent ae)
- Overrides:
initSearch
in classFindAction
-
changed
protected boolean changed(javax.swing.JComponent comp, java.lang.String str, javax.swing.text.Position.Bias bias)
- Specified by:
changed
in classFindAction
-
getNextMatch
protected int getNextMatch(javax.swing.text.JTextComponent textComp, java.lang.String str, int startingOffset, javax.swing.text.Position.Bias bias)
-
focusGained
public void focusGained(java.awt.event.FocusEvent e)
- Specified by:
focusGained
in interfacejava.awt.event.FocusListener
-
focusLost
public void focusLost(java.awt.event.FocusEvent e)
- Specified by:
focusLost
in interfacejava.awt.event.FocusListener
-
getTextComponent
public javax.swing.text.JTextComponent getTextComponent()
-
componentHidden
public void componentHidden(java.awt.event.ComponentEvent e)
- Specified by:
componentHidden
in interfacejava.awt.event.ComponentListener
-
componentMoved
public void componentMoved(java.awt.event.ComponentEvent e)
- Specified by:
componentMoved
in interfacejava.awt.event.ComponentListener
-
componentResized
public void componentResized(java.awt.event.ComponentEvent e)
- Specified by:
componentResized
in interfacejava.awt.event.ComponentListener
-
componentShown
public void componentShown(java.awt.event.ComponentEvent e)
- Specified by:
componentShown
in interfacejava.awt.event.ComponentListener
-
run
public void run()
Waits for closing of the panel.- Specified by:
run
in interfacejava.lang.Runnable
-
interrupt
public void interrupt()
Interrupts the closing Thread.
-
getSearchBar
public javax.swing.JPanel getSearchBar()
- Returns:
- The search bar
-
showSearchBar
public void showSearchBar()
Shows the search bar
-
isAlwaysVisible
public boolean isAlwaysVisible()
- Returns:
- If the search bar isVisible and will not be closed automatically.
-
getCloseButton
public javax.swing.JButton getCloseButton()
- Returns:
- The close button of the search bar.
-
-