Full Screen Exclusive Mode on multiple monitors

I want a full screen exclusive mode window/frame/jframe on two monitors - where each screen has its own exclusive mode display. My graphics environment detects two graphic devices. I create a full screen exclusive mode display for each graphic configuration. The following scenarios occur depending on user actions:

scenario 1 [user lets the program run without interferring]: the display for the first graphics device comes up (a yellow display on screen 1) and then the display for the second graphics device (a blue display) overlaps the first (yellow) display - my thoughts: I didn't expect the blue display to overlap the yellow display.

scenario 2 [when running program, after the yellow display comes up, the user clicks somewhere on the second screen (causing the yellow display to iconify) before the blue screen comes up]: Because of user action, the blue display shows up on the second screen - my thoughts: why did it take the iconification of the yellow display to place the blue display on the correct screen?

Here is the code that I used to test this:

public class TestMultiScreens {

public static void main(String[] argv) {

TestMultiScreens t = new TestMultiScreens();

t.go();

}

public void go() {

try {

GraphicsDevice[] gd = GraphicsEnvironment.

getLocalGraphicsEnvironment().getScreenDevices();

JFrame f1 = new JFrame("one");

JDesktopPane desktopPane1 = new JDesktopPane();

desktopPane1.setOpaque(true);

desktopPane1.setBackground(Color.yellow);

f1.setContentPane(desktopPane1);

System.out.println("gd[0] = " + gd[0].toString());

System.out.println("bounds = " + gd[0].getDefaultConfiguration().getBounds().toString());

gd[0].setFullScreenWindow(f1);

try {

Thread.sleep(3000);

} catch (InterruptedException ie) {

}

JFrame f2 = new JFrame("two");

JDesktopPane desktopPane2 = new JDesktopPane();

desktopPane2.setOpaque(true);

desktopPane2.setBackground(Color.blue);

f2.setContentPane(desktopPane2);

System.out.println("gd[1] = " + gd[1].toString());

System.out.println("bounds = " + gd[1].getDefaultConfiguration().getBounds().toString());

gd[1].setFullScreenWindow(f2);

try {

Thread.sleep(3000);

} catch (InterruptedException ie) {

}

} catch (Exception e) {

e.printStackTrace();

}

System.exit(0);

}

}

Overall, it does not look like full screen exclusive mode supports multi-screens. Plus, it is odd that they iconify when focus is lost on the display.

Any thoughts?

[2655 byte] By [jcavana] at [2007-10-1 23:45:34]
# 1

Quote from the API:

"

In a multi-screen environment, the GraphicsConfiguration objects can be used to render components on multiple screens. The following code sample demonstrates how to create a JFrame object for each GraphicsConfiguration on each screen device in the GraphicsEnvironment:

GraphicsEnvironment ge = GraphicsEnvironment.

getLocalGraphicsEnvironment();

GraphicsDevice[] gs = ge.getScreenDevices();

for (int j = 0; j < gs.length; j++) {

GraphicsDevice gd = gs[j];

GraphicsConfiguration[] gc =

gd.getConfigurations();

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

JFrame f = new

JFrame(gs[j].getDefaultConfiguration());

Canvas c = new Canvas(gc[i]);

Rectangle gcBounds = gc[i].getBounds();

int xoffs = gcBounds.x;

int yoffs = gcBounds.y;

f.getContentPane().add(c);

f.setLocation((i*50)+xoffs, (i*60)+yoffs);

f.show();

}

}

"

Unfortunately I can't test neither your nor this example right now, I will however be back later with some more information(unless this works).

T10a at 2007-7-15 15:36:19 > top of Java-index,Other Topics,Java Game Development...