get Screen Width - Java Swing

Java examples for Swing:Screen

Description

get Screen Width

Demo Code


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

public class Main {
    public static int getScreenWidth() {
        int x = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getDefaultScreenDevice().getDisplayMode().getWidth();
        return x;
    }/*from   w ww  . jav  a 2s.c o m*/
}

Related Tutorials