Get maximum bounds for the screen that contains a given point. @param point Coordinates of point. @param accountForInsets Deduct the space taken up by menu and status bars, etc. (after point is found to be inside bonds) @return Rectangle of bounds or null if point not inside of any scre
(Point point, boolean accountForInsets)
| 105 | * @return Rectangle of bounds or <code>null</code> if point not inside of any screen. |
| 106 | */ |
| 107 | public static Rectangle getScreenBounds(Point point, boolean accountForInsets) { |
| 108 | if (GraphicsEnvironment.isHeadless()) |
| 109 | return new Rectangle(0,0,0,0); |
| 110 | for (GraphicsConfiguration config : getScreenConfigs()) { |
| 111 | Rectangle bounds = config.getBounds(); |
| 112 | if (bounds != null && bounds.contains(point)) { |
| 113 | Insets insets = accountForInsets ? Toolkit.getDefaultToolkit().getScreenInsets(config) : null; |
| 114 | return shrinkByInsets(bounds, insets); |
| 115 | } |
| 116 | } |
| 117 | return null; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Get maximum bounds for the screen that contains a given component. |
no test coverage detected