Module tvbrowser

Class 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
    • Constructor Detail

      • TextComponentFindAction

        public TextComponentFindAction​(javax.swing.text.JTextComponent comp)
      • TextComponentFindAction

        public TextComponentFindAction​(javax.swing.text.JTextComponent comp,
                                       boolean startAtKeyType)
    • Method Detail

      • initSearch

        protected void initSearch​(java.awt.event.ActionEvent ae)
        Overrides:
        initSearch in class FindAction
      • changed

        protected boolean changed​(javax.swing.JComponent comp,
                                  java.lang.String str,
                                  javax.swing.text.Position.Bias bias)
        Specified by:
        changed in class FindAction
      • 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 interface java.awt.event.FocusListener
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent e)
        Specified by:
        focusLost in interface java.awt.event.FocusListener
      • getTextComponent

        public javax.swing.text.JTextComponent getTextComponent()
      • componentHidden

        public void componentHidden​(java.awt.event.ComponentEvent e)
        Specified by:
        componentHidden in interface java.awt.event.ComponentListener
      • componentMoved

        public void componentMoved​(java.awt.event.ComponentEvent e)
        Specified by:
        componentMoved in interface java.awt.event.ComponentListener
      • componentResized

        public void componentResized​(java.awt.event.ComponentEvent e)
        Specified by:
        componentResized in interface java.awt.event.ComponentListener
      • componentShown

        public void componentShown​(java.awt.event.ComponentEvent e)
        Specified by:
        componentShown in interface java.awt.event.ComponentListener
      • run

        public void run()
        Waits for closing of the panel.
        Specified by:
        run in interface java.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.