Class EditorKitMenu

  • All Implemented Interfaces:
    java.awt.datatransfer.FlavorListener, java.awt.event.FocusListener, java.awt.event.MouseListener, java.util.EventListener, javax.swing.event.CaretListener, javax.swing.event.UndoableEditListener

    public class EditorKitMenu
    extends java.lang.Object
    implements javax.swing.event.CaretListener, java.awt.event.MouseListener, java.awt.datatransfer.FlavorListener, java.awt.event.FocusListener, javax.swing.event.UndoableEditListener
    Editor menu kit for Swing text components. Creates an undo manager and a popup menu for the given text component and applies a popup mouse listener by default.
    Author:
    klausj
    • Constructor Detail

      • EditorKitMenu

        public EditorKitMenu​(javax.swing.text.JTextComponent textComponent,
                             EditActionsListener editActionsListener)
        Create editor kit with menu and register edit action listener.
        Parameters:
        textComponent - the Swing text component which will be wrapped by this editor kit
        editActionsListener - listener is notified about active edit actions if the widget gains foucus
      • EditorKitMenu

        public EditorKitMenu​(javax.swing.text.JTextComponent textComponent)
        Create editor kit with menu.
        Parameters:
        textComponent - the Swing text component which will be wrapped by this editor kit
      • EditorKitMenu

        public EditorKitMenu​(javax.swing.text.JTextComponent textComponent,
                             boolean editable)
        Create editor kit with menu. If editable is false the cut action will not be added to the menu.
        Parameters:
        textComponent - the Swing text component which will be wrapped by this editor kit
        editable - if false the widget content is considered as reda only
    • Method Detail

      • createJPopupMenu

        public javax.swing.JPopupMenu createJPopupMenu()
      • isPopupMenuActiv

        public boolean isPopupMenuActiv()
      • setPopupMenuActiv

        public void setPopupMenuActiv​(boolean popupMenuActiv)
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
      • caretUpdate

        public void caretUpdate​(javax.swing.event.CaretEvent arg0)
        Specified by:
        caretUpdate in interface javax.swing.event.CaretListener
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed 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 arg0)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent arg0)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent arg0)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • undoableEditHappened

        public void undoableEditHappened​(javax.swing.event.UndoableEditEvent e)
        Specified by:
        undoableEditHappened in interface javax.swing.event.UndoableEditListener
      • flavorsChanged

        public void flavorsChanged​(java.awt.datatransfer.FlavorEvent e)
        Specified by:
        flavorsChanged in interface java.awt.datatransfer.FlavorListener
      • addEditActionListener

        public void addEditActionListener​(EditActionsListener editActionsListener)
      • removeEditActionListener

        public void removeEditActionListener​(EditActionsListener editActionsListener)
      • 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
      • discardAllEdits

        public void discardAllEdits()
      • release

        public void release()