java windowbuilder multiple monitors windowed mode

Solutions on MaxInterview for java windowbuilder multiple monitors windowed mode by the best coders in the world

showing results for - "java windowbuilder multiple monitors windowed mode"
Lucas
12 Jan 2020
1public Main() {
2
3    JFrame testingBlack = new JFrame("MCVe");
4
5    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
6    GraphicsDevice[] gds = ge.getScreenDevices();
7    GraphicsConfiguration gc = gds[1].getDefaultConfiguration();
8    Rectangle rect = gc.getBounds();
9    testingBlack.setLocation(rect.getLocation());
10
11    // or, if you like this style better
12
13    testingBlack.setLocation(GraphicsEnvironment
14                             .getLocalGraphicsEnvironment()
15                             .getScreenDevices()[1]
16                             .getDefaultConfiguration()
17                             .getBounds()
18                             .getLocation());
19
20    testingBlack.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
21    testingBlack.setVisible(true);
22}