您可以尝试:
int width = 0;int height = 0;GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();GraphicsDevice[] gs = ge.getScreenDevices();for (GraphicsDevice curGs : gs){ DisplayMode mode = curGs.getDisplayMode(); width += mode.getWidth(); height = mode.getHeight();}
这应该计算多个屏幕的总宽度。显然,它仅支持上述形式的水平对齐的屏幕-您必须分析图形配置的边界以处理其他监视器对齐(取决于您要制作的防d效果)。
编辑:然后设置框架的大小:
f.setSize(width, height);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)