How do I get my screen size?

package org.kodejava.example.awt;

import java.awt.*;

public class ScreenSizeExample {
    public static void main(String[] args) {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

        System.out.println("Screen Width: " + screenSize.getWidth());
        System.out.println("Screen Height: " + screenSize.getHeight());
    }
}

Wayan Saryada

Programmer, runner, recreational diver, currently living in the island of Bali, Indonesia. Mostly programming in Java, creating web based application with Spring Framework, Hibernate / JPA.

Leave a Reply