Class ClipboardUtils
java.lang.Object
org.openstreetmap.josm.gui.datatransfer.ClipboardUtils
This is a utility class that provides methods useful for general data transfer support.
- Since:
- 10604
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanclear()Clears the system clipboard.static booleancopy(Transferable transferable) Copies the given transferable to the clipboard.static booleancopyString(String s) Copy the given string to the clipboard.static ClipboardThis method should be used from all of JOSM to access the clipboard.static TransferableExtracts clipboard content asTransferableobject.static TransferablegetClipboardContent(Clipboard clipboard) Extracts clipboard content asTransferableobject.static StringGets the clipboard content as string.static ClipboardGets the singleton instance of the system selection as aClipboardobject.static DataFlavornewDataFlavor(Class<?> c, String humanPresentableName) Returns a newDataFlavorfor the given class and human-readable name.
-
Field Details
-
clipboard
-
-
Constructor Details
-
ClipboardUtils
private ClipboardUtils()
-
-
Method Details
-
getClipboard
This method should be used from all of JOSM to access the clipboard.It will default to the system clipboard except for cases where that clipboard is not accessible.
- Returns:
- A clipboard.
- See Also:
-
getSystemSelection
Gets the singleton instance of the system selection as aClipboardobject. This allows an application to read and modify the current, system-wide selection.- Returns:
- the system selection as a
Clipboard, ornullif the native platform does not support a system selectionClipboardor if GraphicsEnvironment.isHeadless() returns true - See Also:
-
getClipboardStringContent
Gets the clipboard content as string.- Returns:
- the content if available,
nullotherwise.
-
getClipboardContent
Extracts clipboard content asTransferableobject. Using this method avoids some problems on some platforms.- Returns:
- The content or
nullif it is not available
-
getClipboardContent
Extracts clipboard content asTransferableobject. Using this method avoids some problems on some platforms.- Parameters:
clipboard- clipboard from which contents are retrieved- Returns:
- clipboard contents if available,
nullotherwise.
-
copyString
Copy the given string to the clipboard.- Parameters:
s- The string to copy.- Returns:
- True if the copy was successful
-
copy
Copies the given transferable to the clipboard. Handles state problems that occur on some platforms.- Parameters:
transferable- The transferable to copy.- Returns:
- True if the copy was successful
-
newDataFlavor
Returns a newDataFlavorfor the given class and human-readable name.- Parameters:
c- classhumanPresentableName- the human-readable string used to identify this flavor- Returns:
- a new
DataFlavorfor the given class and human-readable name - Since:
- 10801
-
clear
Clears the system clipboard.- Returns:
- True if the clear was successful
- Since:
- 14500
-