import java.util.*; import java.util.zip.*; import java.util.List; import java.util.regex.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.table.*; import java.io.*; import java.net.*; import java.lang.reflect.*; import java.lang.ref.*; import java.lang.management.*; import java.security.*; import java.security.spec.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.imageio.*; import java.math.*; import javax.swing.event.AncestorListener; import javax.swing.event.AncestorEvent; import javax.swing.Timer; public class main { static int count, max = 20; static int delay = 200; static BufferedImage img, img2; static JWindow window; static JLabel lbl; public static void main(String[] args) throws Exception { SwingUtilities.invokeLater(new Runnable() { public void run() { try { 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, new Runnable() { public void run() { try { go(); } catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }}}); } catch (Exception _e) { throw _e instanceof RuntimeException ? (RuntimeException) _e : new RuntimeException(_e); } } });} static void go() { ++count; if (count >= max) window.dispose(); else { lbl.setIcon(new ImageIcon((count & 1) == 0 ? img : img2)); swingAfter(lbl, delay, new Runnable() { public void run() { try { go(); } catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }}}); } } static void swingAfter(JFrame base, int delay, Runnable r) { installTimer((JComponent) base.getContentPane(), r, delay, delay, false); } static void swingAfter(JComponent base, int delay, Runnable r) { installTimer(base, r, delay, delay, false); } static BufferedImage changeBrightness(BufferedImage src, float val) { return new RescaleOp(val, 0, null).filter(src, null); } // first delay = delay static void installTimer(JComponent component, Runnable r, int delay) { installTimer(component, r, delay, delay); } // first delay = delay static void installTimer(JFrame frame, int delay, Runnable r) { installTimer(frame.getRootPane(), r, delay, delay); } // first delay = delay static void installTimer(JComponent component, int delay, Runnable r) { installTimer(component, r, delay, delay); } static void installTimer(final JComponent component, final Runnable r, final int delay, final int firstDelay) { installTimer(component, r, delay, firstDelay, true); } static void installTimer(final JComponent component, final Runnable r, final int delay, final int firstDelay, final boolean repeats) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { final Timer timer = new Timer(delay, new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent _evt) { r.run(); }}); timer.setInitialDelay(firstDelay); timer.setRepeats(repeats); if (component.isShowing()) timer.start(); component.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { timer.start(); } public void ancestorRemoved(AncestorEvent event) { timer.stop(); } public void ancestorMoved(AncestorEvent event) { } }); } catch (Exception _e) { throw _e instanceof RuntimeException ? (RuntimeException) _e : new RuntimeException(_e); } } }); } }