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).

!752

static int count, max = 20;
static int delay = 200;
static BufferedImage img, img2;
static JWindow window;
static JLabel lbl;

p-awt {
  Rectangle r = new Rectangle(35-30, 755-10, 60, 20);
  
  // clip to screen
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  r = new Rectangle(screenSize).intersection(r);
  
  Robot robot = new Robot();
  img = robot.createScreenCapture(r);
  img2 = changeBrightness(img, 2f);
  img = changeBrightness(img, 0.5f);
  
  // make JWindow
  window = new JWindow;
  window.setBounds(r);
  lbl = new JLabel(new ImageIcon(img2));
  window.add(lbl);
  window.setVisible(true);
  
  swingAfter(lbl, delay, r { go(); });
}

static void go() {
  ++count;
  if (count >= max)
    window.dispose();
  else {
    lbl.setIcon(new ImageIcon((count & 1) == 0 ? img : img2));
    swingAfter(lbl, delay, r { go(); });
  }
}

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: 509 / 580
Referenced in: #1003735 - blinkScreenArea