Java Swing Tutorial - Java Toolkit.getScreenResolution()


Toolkit.getScreenResolution() has the following syntax.

public abstract int getScreenResolution()     throws HeadlessException


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.