Java Swing Tutorial - Java Toolkit.getScreenResolution()








Syntax

Toolkit.getScreenResolution() has the following syntax.

public abstract int getScreenResolution()     throws HeadlessException

Example

In the following code shows how to use Toolkit.getScreenResolution() method.

import java.awt.Toolkit;
/* ww w.j a v a2  s.c  o  m*/
public class Main {
  public static void main(String[] args) {
    Toolkit tk = Toolkit.getDefaultToolkit();

    System.out.println("Screen resolution = " + tk.getScreenResolution());

  }
}

The code above generates the following result.