is Point On Screen - Java Swing

Java examples for Swing:Screen

Description

is Point On Screen

Demo Code


//package com.java2s;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point;

public class Main {
    public static boolean isPointOnScreen(Point p) {
        GraphicsDevice[] devices = GraphicsEnvironment
                .getLocalGraphicsEnvironment().getScreenDevices();
        for (GraphicsDevice device : devices) {
            if (device.getDefaultConfiguration().getBounds().contains(p)) {
                return true;
            }//from   w w  w . j  a va 2s .  c  om
        }
        return false;
    }
}

Related Tutorials