get Location On Current Screen - Java Swing

Java examples for Swing:Screen

Description

get Location On Current Screen

Demo Code


//package com.java2s;
import java.awt.*;

public class Main {
    public static Point getLocationOnCurrentScreen(final Component c) {
        if (c != null) {
            final Rectangle currentScreenBounds = c
                    .getGraphicsConfiguration().getBounds();
            return new Point(currentScreenBounds.x, currentScreenBounds.y);
        } else {/*  www.jav  a  2  s . c o m*/
            return new Point(0, 0);
        }
    }
}

Related Tutorials