Correctly check images against their dimensions for image polling

MYC-Refactor
Hammy 3 years ago
parent ed97a46735
commit 8b467ab3d9

@ -27,7 +27,10 @@ class ClipboardUtils {
myClipboardContent.setOldContent(contents.getTransferData(TEXT.getDataFlavor())); myClipboardContent.setOldContent(contents.getTransferData(TEXT.getDataFlavor()));
} else if (IMAGE.isAvailable(clipboard)) { } else if (IMAGE.isAvailable(clipboard)) {
BufferedImage bufferedImage = convertToBufferedImage((Image) contents.getTransferData(IMAGE.getDataFlavor())); BufferedImage bufferedImage = convertToBufferedImage((Image) contents.getTransferData(IMAGE.getDataFlavor()));
myClipboardContent.setOldContent(new Dimension(bufferedImage.getWidth(), bufferedImage.getHeight())); myClipboardContent.setOldContent(bufferedImage);
myClipboardContent.setOldDimensionContent(new Dimension(bufferedImage.getWidth(), bufferedImage.getHeight()));
} else if (FILELIST.isAvailable(clipboard)) {
myClipboardContent.setOldContent(contents.getTransferData(FILELIST.getDataFlavor()));
} }
} catch (UnsupportedFlavorException | IOException exp) { } catch (UnsupportedFlavorException | IOException exp) {
exp.printStackTrace(); exp.printStackTrace();

@ -1,7 +1,10 @@
package me.goudham.domain; package me.goudham.domain;
import java.awt.Dimension;
public class MyClipboardContent<T> { public class MyClipboardContent<T> {
private T oldContent; private T oldContent;
private Dimension oldDimensionContent;
public MyClipboardContent() { public MyClipboardContent() {
} }
@ -13,4 +16,12 @@ public class MyClipboardContent<T> {
public T getOldContent() { public T getOldContent() {
return oldContent; return oldContent;
} }
public void setOldDimensionContent(Dimension oldDimensionContent) {
this.oldDimensionContent = oldDimensionContent;
}
public Dimension getOldDimensionContent() {
return oldDimensionContent;
}
} }

Loading…
Cancel
Save