Browse souce code repository at: https://github.com/jjYBdx4IL/java-evaluation/blob/master/src/test/java/tests/java/awt/MultiscreenTest.java
/*
 * #%L
 * Evaluation
 * %%
 * Copyright (C) 2016 Github jjYBdx4IL Projects
 * %%
 * #L%
 */
package tests.java.awt;

import com.github.jjYBdx4IL.utils.awt.AWTUtils;

import java.awt.GraphicsEnvironment;
import java.awt.MouseInfo;
import java.awt.event.WindowEvent;
import java.lang.reflect.InvocationTargetException;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author Github jjYBdx4IL Projects
 */
public class MultiscreenTest {

    private static final Logger LOG = LoggerFactory.getLogger(MultiscreenTest.class);

    @BeforeClass
    public static void beforeClass() {
        Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    }

    @Test
    public void determineActiveScreenTest() throws InterruptedException, InvocationTargetException {
        final JFrame jf = new JFrame("title");
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                LOG.info(ge.getDefaultScreenDevice().getIDstring());

                LOG.info(MouseInfo.getPointerInfo().getDevice().toString());

                jf.setAlwaysOnTop(true);
                //jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                JLabel label = new JLabel("test");
                jf.add(label);
                jf.pack();
                AWTUtils.centerOnMouseScreen(jf);
                jf.setVisible(true);
            }
        });
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
        }
        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                jf.dispatchEvent(new WindowEvent(jf, WindowEvent.WINDOW_CLOSING));
            }
        });
    }
}
-------------------------------------------------------------------------------
Test set: tests.java.awt.MultiscreenTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.985 s - in tests.java.awt.MultiscreenTest
determineActiveScreenTest  Time elapsed: 0.985 s