Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean isValid(int x, int y)
- {
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- double width = screenSize.getWidth();
- double height = screenSize.getHeight();
- if(x >= (width / 2) && x <= width && y >= (height / 2) && y <= height)
- {
- return true;
- }
- else
- {
- System.out.println("---------INVALID COORDINATES------------");
- System.out.printf("(%d,%d) exceed the maximum screen size%n", x, y);
- System.out.println("----------------------------------------");
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement