Getting current screen resolution using java

import java.awt.*;
public class screenDim {
public static void main(String[] args) {
try{
Toolkit newTollKit=Toolkit.getDefaultToolkit();
Dimension screenDim=newTollKit.getScreenSize();
System.out.println("Screen height in pixels: "+screenDim.height);
System.out.println("Screen width in pixels: "+screenDim.width);
}
catch(Exception e){
e.printStackTrace();
}

}

}

Comments

Popular Posts