Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

39
LINES

< > BotCompany Repo | #1003734 // Make Screen Area Blink (dev.)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (135L/2K/6K).

1  
!752
2  
3  
static int count, max = 20;
4  
static int delay = 200;
5  
static BufferedImage img, img2;
6  
static JWindow window;
7  
static JLabel lbl;
8  
9  
p-awt {
10  
  Rectangle r = new Rectangle(35-30, 755-10, 60, 20);
11  
  
12  
  // clip to screen
13  
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
14  
  r = new Rectangle(screenSize).intersection(r);
15  
  
16  
  Robot robot = new Robot();
17  
  img = robot.createScreenCapture(r);
18  
  img2 = changeBrightness(img, 2f);
19  
  img = changeBrightness(img, 0.5f);
20  
  
21  
  // make JWindow
22  
  window = new JWindow;
23  
  window.setBounds(r);
24  
  lbl = new JLabel(new ImageIcon(img2));
25  
  window.add(lbl);
26  
  window.setVisible(true);
27  
  
28  
  swingAfter(lbl, delay, r { go(); });
29  
}
30  
31  
static void go() {
32  
  ++count;
33  
  if (count >= max)
34  
    window.dispose();
35  
  else {
36  
    lbl.setIcon(new ImageIcon((count & 1) == 0 ? img : img2));
37  
    swingAfter(lbl, delay, r { go(); });
38  
  }
39  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003734
Snippet name: Make Screen Area Blink (dev.)
Eternal ID of this version: #1003734/1
Text MD5: 538b5638362db628335e582dbf37ba47
Transpilation MD5: 05efcf3eb03d2234f4941e14fc7b2e4e
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-26 16:48:18
Source code size: 908 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 510 / 583
Referenced in: [show references]