📜  在第二个监视器上启动 java windowbuilder - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:30.258000             🧑  作者: Mango

代码示例1
public static void showOnScreen( int screen, JFrame frame ) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    
    if(screen > -1 && screen < gs.length) {
        gs[screen].setFullScreenWindow(frame);
    }else if(gs.length > 0) {
        gs[0].setFullScreenWindow(frame);
    }else {
        throw new RuntimeException("No Screens Found");
    }
}