The LocalGraphicsEnvironment in Java will give you the center point of the display or screen. There is a static method getLocalGraphicsEnvironment() in GraphicsEnvironment class. To get the center point of the screen, you may use the following java code:
Point centre=GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
You should include these import statements in the file.
import java.awt.Point;
import java.awt.GraphicsEnvironment;
No comments:
Post a Comment