Package PamView
Class ClipboardCopier
java.lang.Object
PamView.ClipboardCopier
- All Implemented Interfaces:
ClipboardOwner
,Transferable
,Printable
Class to Copy graphics content to the clipboard and the printer
Written so that it can easily be added to any PAMGUARD component. Provides default menu items for including in pop up menus or main menu.
- Author:
- Doug Gillespie
-
Field Summary
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
ConstructorDescriptionClipboardCopier
(Component component) ClipboardCopier
(Component component, String printJobName) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Copy an image of the component to the clip boardGet a menu item with a default title of "Copy to clipboard".getCopyMenuItem
(String menuTitle) Get a menu item with a given title.Get a menu item with a default title of "Print ...".getPrintMenuItem
(String menuTitle) Get a menu item with a given title.getTransferData
(DataFlavor flavor) boolean
isDataFlavorSupported
(DataFlavor flavor) void
lostOwnership
(Clipboard arg0, Transferable arg1) int
print
(Graphics g, PageFormat pf, int page) void
void
setPrintJobName
(String printJobName)
-
Constructor Details
-
ClipboardCopier
- Parameters:
component
- Component to copy. All children will also be copied.
-
ClipboardCopier
- Parameters:
component
- Component to copy. All children will also be copied.printJobName
- name for print job (default is PAMGUARD)
-
-
Method Details
-
copyToClipBoard
public void copyToClipBoard()Copy an image of the component to the clip board -
lostOwnership
- Specified by:
lostOwnership
in interfaceClipboardOwner
-
getTransferData
- Specified by:
getTransferData
in interfaceTransferable
- Throws:
UnsupportedFlavorException
IOException
-
getTransferDataFlavors
- Specified by:
getTransferDataFlavors
in interfaceTransferable
-
isDataFlavorSupported
- Specified by:
isDataFlavorSupported
in interfaceTransferable
-
print
- Specified by:
print
in interfacePrintable
- Throws:
PrinterException
-
getCopyMenuItem
Get a menu item with a default title of "Copy to clipboard". Menu action listeners will automatically be set up- Returns:
- menu item.
-
getCopyMenuItem
Get a menu item with a given title. Menu action listeners will automatically be set up- Parameters:
menuTitle
- menu title- Returns:
- menu item.
-
getPrintMenuItem
Get a menu item with a default title of "Print ...". Menu action listeners will automatically be set up- Returns:
- menu item.
-
getPrintMenuItem
Get a menu item with a given title. Menu action listeners will automatically be set up- Parameters:
menuTitle
- menu title- Returns:
- menu item.
-
getPrintJobName
-
setPrintJobName
-
setImage
-