In the original source code for the TransparentBackground (now somewhat rewritten) the Toolkit is asked for screen dimensions. But if one is using two monitors, just one of the monitors dimensions is reported. This makes the image transparent on just one of the monitors. According to http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#windowCentering this now needs something like
public void updateBackground() {
try {
Robot rbt = new Robot();
background = rbt.createScreenCapture(getTotalScreenBounds());
} catch (Exception ex) {
p(ex.toString());
ex.printStackTrace();
}
}
private Rectangle getTotalScreenBounds(){
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
int w = 0, h = 0;
for(int i = 0; i < ge.getScreenDevices().length; i++){
w += ge.getMaximumWindowBounds().width;
}
h = ge.getMaximumWindowBounds().height;
return new Rectangle(0,0, w, h);
}
In this case I'm presuming that the two monitors are placed beside each other not ontop.
Showing messages 1 through 1 of 1.
Problem with multiple monitors
2007-04-19 11:05:53
wisaac00
[View]
Also assumes that both monitors are running in the same resolution.