Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java windowbuilder multiple monitors windowed mode

public Main() {

    JFrame testingBlack = new JFrame("MCVe");

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    GraphicsConfiguration gc = gds[1].getDefaultConfiguration();
    Rectangle rect = gc.getBounds();
    testingBlack.setLocation(rect.getLocation());

    // or, if you like this style better

    testingBlack.setLocation(GraphicsEnvironment
                             .getLocalGraphicsEnvironment()
                             .getScreenDevices()[1]
                             .getDefaultConfiguration()
                             .getBounds()
                             .getLocation());

    testingBlack.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    testingBlack.setVisible(true);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #windowbuilder #multiple #monitors #windowed #mode
ADD COMMENT
Topic
Name
4+2 =