Java examples for Swing:Screen
is Y On Screen
//package com.java2s; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class Main { public static boolean isYOnScreen(int y) { GraphicsDevice[] devices = GraphicsEnvironment .getLocalGraphicsEnvironment().getScreenDevices(); for (GraphicsDevice device : devices) { int boundA = device.getDefaultConfiguration().getBounds().y; int boundB = boundA + device.getDefaultConfiguration().getBounds().height; if (inBounds(y, boundA, boundB)) { return true; }/*from w ww .j a v a 2 s . com*/ } return false; } private static boolean inBounds(int x, int boundA, int boundB) { if (boundA < boundB) { return x >= boundA && x <= boundB; } return x <= boundA && x >= boundB; } }