Add util method for retrieving OldClipboardContent when object is passed in

MYC-Refactor
Hammy 3 years ago
parent 0e76d29495
commit 8fdc3e61c3

@ -54,6 +54,20 @@ class ClipboardUtils {
return oldClipboardContent;
}
static OldClipboardContent getOldClipboardContent(Object object) {
OldClipboardContent oldClipboardContent = null;
if (object instanceof String) {
oldClipboardContent = new OldClipboardContent((String) object);
} else if (object instanceof BufferedImage) {
oldClipboardContent = new OldClipboardContent((BufferedImage) object);
} else if (object instanceof List) {
oldClipboardContent = new OldClipboardContent((List<File>) object);
}
return oldClipboardContent;
}
static BufferedImage convertToBufferedImage(Image image) {
BufferedImage newImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);

Loading…
Cancel
Save