Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
package com.ecc.swing2;
import java.awt.*;
import javax.swing.*;
public class MultimonitorExample {
public static void main(String[] args) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gd = ge.getScreenDevices();
System.out.println("There are " + gd.length + " screen device(s)");
ImageIcon image = new ImageIcon("D:/images/Belgium.gif");
for (int i = 0; i < gd.length; i++) {
GraphicsConfiguration[] gcs = gd[i].getConfigurations();
System.out.println("Device " + i + " has " + gcs.length + " configuration(s)");
for (int j=0; j<gcs.length; j++) {
System.out.println("\tConfig " + j + " bounds: " + gcs[j].getBounds());
}
JFrame f = new JFrame("Screen " + i);
JLabel l = new JLabel(image);
f.getContentPane().add(l);
f.pack();
GraphicsConfiguration gc = gd[i].getDefaultConfiguration();
Rectangle pt = gc.getBounds();
f.setLocation(pt.x + 100, pt.y +100);
f.setVisible(true);
}
}
}