Thursday, 21 October 2021

Java: Get the screen resolution in dots-per-inch.

Toolkit#getScreenResolution method return the screen resolution in dots-per-inch.

 

ScreenResolutionDotsPerInchDemo.java

package com.sample.app.awtprograms;

import java.awt.Toolkit;

public class ScreenResolutionDotsPerInchDemo {

	public static void main(String args[]) {
		int screenResolution = Toolkit.getDefaultToolkit().getScreenResolution();

		System.out.println("screen resolution in dots-per-inch : " + screenResolution);

	}

}

 

Output

screen resolution in dots-per-inch : 129

  

Previous                                                    Next                                                    Home

No comments:

Post a Comment