Methods Summary |
---|
public void | componentHidden(java.awt.event.ComponentEvent evt)
|
public void | componentMoved(java.awt.event.ComponentEvent evt) repaint();
|
public void | componentResized(java.awt.event.ComponentEvent evt) repaint();
|
public void | componentShown(java.awt.event.ComponentEvent evt) repaint();
|
public static void | p(java.lang.String str)
System.out.println(str);
|
public void | paintComponent(java.awt.Graphics g)
Point pos = this.getLocationOnScreen();
Point offset = new Point(-pos.x,-pos.y);
g.drawImage(background,offset.x,offset.y,null);
|
public void | refresh()
if(this.isVisible() && frame.isVisible()) {
repaint();
refreshRequested = true;
lastupdate = new Date().getTime();
}
|
public void | run()
try {
while(true) {
Thread.sleep(250);
long now = new Date().getTime();
if(refreshRequested &&
((now - lastupdate) > 1000)) {
if(frame.isVisible()) {
Point location = frame.getLocation();
frame.hide();
updateBackground();
frame.show();
frame.setLocation(location);
refresh();
}
lastupdate = now;
refreshRequested = false;
}
}
} catch (Exception ex) {
p(ex.toString());
ex.printStackTrace();
}
|
public void | updateBackground()
try {
Robot rbt = new Robot();
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension dim = tk.getScreenSize();
background = rbt.createScreenCapture(
new Rectangle(0,0,(int)dim.getWidth(),(int)dim.getHeight()));
} catch (Exception ex) {
p(ex.toString());
ex.printStackTrace();
}
|
public void | windowGainedFocus(java.awt.event.WindowEvent evt) refresh();
|
public void | windowLostFocus(java.awt.event.WindowEvent evt) refresh();
|