Class ClipboardAction

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

    public class ClipboardAction
    extends javax.swing.AbstractAction
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.datatransfer.Transferable contents
      The contents that are transfered into the clipboard when the action is executed.
      private long lastPopupShowTime
      The UNIX epoch time when the popup for this action was shown the last time
      private javax.swing.JPopupMenu popup
      A small popup that shows up when the key has been moved to the clipboard
      private static long POPUP_DURATION
      The duration in milliseconds for which the popup will be shown
      private java.awt.Component popupParent
      The component which is used as parent of the shown popup.
      private static long serialVersionUID  
      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • Constructor Summary

      Constructors 
      Constructor Description
      ClipboardAction​(java.lang.String name, java.awt.datatransfer.Transferable contents)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)  
      void setContents​(java.awt.datatransfer.Transferable contents)  
      void setPopupParent​(java.awt.Component popupParent)
      Sets the component, under which the popup will be shown, which indicates that the key was copied to the clipboard.
      • Methods inherited from class javax.swing.AbstractAction

        addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.Action

        accept
    • Field Detail

      • popup

        private final javax.swing.JPopupMenu popup
        A small popup that shows up when the key has been moved to the clipboard
      • popupParent

        private java.awt.Component popupParent
        The component which is used as parent of the shown popup. If this is null, no popup will be shown.
      • lastPopupShowTime

        private long lastPopupShowTime
        The UNIX epoch time when the popup for this action was shown the last time
      • contents

        private java.awt.datatransfer.Transferable contents
        The contents that are transfered into the clipboard when the action is executed. If this is null, the clipboard won't be changed.
    • Constructor Detail

      • ClipboardAction

        public ClipboardAction​(java.lang.String name,
                               java.awt.datatransfer.Transferable contents)
    • Method Detail

      • setContents

        public void setContents​(java.awt.datatransfer.Transferable contents)
        Parameters:
        contents - the contents, which should be copied to the clipboard when the Action is executed
      • setPopupParent

        public void setPopupParent​(java.awt.Component popupParent)
        Sets the component, under which the popup will be shown, which indicates that the key was copied to the clipboard.
        Parameters:
        popupParent - the component to set as parent of the popup
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)