Java Web Start on Secondary Monitor

Hello,

I am testing my JWS app with a multi-monitor setup. When I drag my browser window over to the second monitor, and launch my application, the Java Console opens in the second monitor, but my application opens in the user's default monitor. I was wondering if anyone knows how my application can figure out what monitor it was launched from. I am hopeful because the Java Console opens in the right monitor.

Thanks for any help.

-Ryan

[465 byte] By [brewer79a] at [2007-11-26 22:42:54]
# 1

yes - you can use sun.awt.GraphicsEnvironment class to determine what Screen the mouse is on:

Rectangle getBoundsOfThisScreen() {

GraphicsDevice[] devices = GraphicsEnvironment.

getLocalGraphicsEnvironment().getScreenDevices();

for (int i=0; i<devices.length; i++) {

Rectangle bounds =

devices[i].getDefaultConfiguration().getBounds();

//check to see if the mouse cursor is within these bounds

if (mousePoint.x >= bounds.x && mousePoint.y >= bounds.y

&& mousePoint.x <= (bounds.x + bounds.width)

&& mousePoint.y <= (bounds.y + bounds.height)) {

//this is it

return bounds;

}

}

// you are nowhere ?

return new Rectangle(0,0,0,0);

}

Then you can position window relative to those bounds.

/Andy

dietz333a at 2007-7-10 11:58:50 > top of Java-index,Desktop,Deploying...