// TODO: hide on mouse over static BlinkScreenArea blinkScreenArea(Rectangle r) { ret new BlinkScreenArea(r).go(); } sclass BlinkScreenArea { int count, max = 12; int delay = 150; BufferedImage img, img2; JWindow window; JLabel lbl; Rectangle area; *(Rectangle r) ctex { // clip to screen Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize (); r = new Rectangle(screenSize).intersection(r); area = r; new Robot robot; img = robot.createScreenCapture(r); img2 = changeBrightness(img, 2f); img = changeBrightness(img, 0.5f); } BlinkScreenArea go() { awt { // make JWindow window = new JWindow; window.setBounds(area); lbl = new JLabel(new ImageIcon(img2)); window.add(lbl); window.setAlwaysOnTop(true); window.setVisible(true); installTimer(lbl, delay, r { step(); }); } ret this; } void step() { ++count; if (count > max) print("huh?"); else if (count == max) window.dispose(); // should stop timer too else lbl.setIcon(new ImageIcon((count & 1) == 0 ? img : img2)); } }
Began life as a copy of #1003734
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003735 |
Snippet name: | blinkScreenArea |
Eternal ID of this version: | #1003735/1 |
Text MD5: | 4a9f54901b633787b9b405c3aa8a668a |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-26 16:59:27 |
Source code size: | 1202 bytes / 51 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 534 / 537 |
Referenced in: | [show references] |