I'd like to know if it's possible to detect the main monitor of a computer in Java, and if so I'd like to know how to(I.e. code example).
If you have an JFrame running, the following will give you the list of devices:
GraphicsEnvironment gEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] dDevices= gEnvironment.getScreenDevices();
Not sure, but the first one should be the default one.
You can also try:
GraphicsEnvironment gEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice dDevice= gEnvironment.getDefaultScreenDevice();
Which returns the default screen device.