The current screen resolution is a useful piece of information to know - particularly if you want to place a frame window in the very center of the screen. The screen dimensions can be found through the aid of the getScreenSize() method of the default screen toolkit.
import java.awt.*;
public class GetScreenSize()
{
public static void main(String args[])
{
// Get the default toolkit
Toolkit toolkit = Toolkit.getDefaultToolkit();
// Get the current screen size
Dimension scrnsize = toolkit.getScreenSize();
// Print the screen size
System.out.println ("Screen size : " + scrnsize);
// Exit gracefully
System.exit(0);
}
}
SOURCE : www.referjava.com
No comments:
Post a Comment