public class ClipboardAction extends AbstractAction
Modifier and Type | Field and Description |
---|---|
private 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 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 Component |
popupParent
The component which is used as parent of the shown popup.
|
private static long |
serialVersionUID |
changeSupport, enabled
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 and Description |
---|
ClipboardAction(String name,
Transferable contents) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
void |
setContents(Transferable contents) |
void |
setPopupParent(Component popupParent)
Sets the component, under which the popup will be shown, which indicates that the key was copied to the clipboard.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
private static final long serialVersionUID
private static final long POPUP_DURATION
private final JPopupMenu popup
private Component popupParent
null
, no popup will be shown.private long lastPopupShowTime
private Transferable contents
null
, the clipboard won't be changed.public ClipboardAction(String name, Transferable contents)
public void setContents(Transferable contents)
contents
- the contents, which should be copied to the clipboard when the Action
is executedpublic void setPopupParent(Component popupParent)
popupParent
- the component to set as parent of the popuppublic void actionPerformed(ActionEvent e)