Download Jar. Uses 3874K of libraries. Click here for Pure Java version (3997L/27K).
!7 static JFrame frame; static S imageMD5, text; p-substance { frame = showFrame("Clipboard"); installTimer(frame, 3000, 0, r { update(); }); hideConsoleIfMainProgram(); } svoid update { BufferedImage img = getImageFromClipboard(); if (img != null) { S md5 = md5OfRGBImage(new RGBImage(img)); if (neq(md5, imageMD5)) { imageMD5 = md5; text = null; setFrameContents(frame, jscroll(new ImageSurface(img))); setFrameTitle(frame, "Clipboard: " + img.getWidth() + "*" + img.getHeight() + " px image"); } ret; } imageMD5 = null; S s = getTextFromClipboard(); if (s != null) { if (neq(text, s)) { text = s; setFrameContents(frame, typeWriterTextArea(s)); setFrameTitle(frame, "Clipboard: " + quote(escapeNewLines(shorten(s, 256)))); } ret; } text = null; // empty clipboard or unknown contents setFrameContents(frame, new JPanel); Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); setFrameTitle(frame, transferable != null ? "Unknown clipboard contents (" + join(", ", mimeTypes(transferable)) + ")" : "Empty clipboard"); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006099 |
Snippet name: | Show clipboard (live-updated) |
Eternal ID of this version: | #1006099/6 |
Text MD5: | f0de8f5b01387d04a289338beddc98bf |
Transpilation MD5: | d8d1e61efbd1e292c13c649972b74c40 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-23 14:51:35 |
Source code size: | 1215 bytes / 42 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 664 / 1341 |
Version history: | 5 change(s) |
Referenced in: | [show references] |