A snippet from my Java application:
JFrame f = new JFrame();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd
A more general solution to Ash's code is to union the bounds of all the graphics configurations
Rectangle2D result = new Rectangle2D.Double();
GraphicsEnvironment localGE = GraphicsEnvironment.getLocalGraphicsEnvironment();
for (GraphicsDevice gd : localGE.getScreenDevices()) {
for (GraphicsConfiguration graphicsConfiguration : gd.getConfigurations()) {
result.union(result, graphicsConfiguration.getBounds(), result);
}
}
f.setSize(result.getWidth(), result.getHeight());
This will work for vertically aligned monitors as well as horizontal.