public final class ScreenUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISPOSE_TEMPORARY |
Modifier and Type | Method and Description |
---|---|
static void |
cropRectangleToFitTheScreen(java.awt.Rectangle rect) |
static java.awt.Point |
findNearestPointOnBorder(java.awt.Rectangle rect,
java.awt.Point p) |
static void |
fitToScreen(java.awt.Rectangle r) |
static void |
fitToScreenVertical(java.awt.Rectangle rectangle,
int top,
int bottom,
boolean rightAligned)
Finds the best place for the specified rectangle on the screen.
|
static java.awt.Rectangle |
getAllScreensRectangle()
Returns the smallest rectangle that encloses a visible area of every screen.
|
static java.awt.Shape |
getAllScreensShape() |
static java.awt.Rectangle |
getMainScreenBounds() |
static java.awt.GraphicsDevice |
getScreenDevice(java.awt.Rectangle bounds) |
static java.awt.Insets |
getScreenInsets(java.awt.GraphicsConfiguration gc) |
static java.awt.Rectangle |
getScreenRectangle(java.awt.Component component) |
static java.awt.Rectangle |
getScreenRectangle(java.awt.GraphicsConfiguration configuration)
Returns a visible area for the specified graphics configuration.
|
static java.awt.Rectangle |
getScreenRectangle(int x,
int y)
Returns a visible area for a graphics device that is the closest to the specified point.
|
static java.awt.Rectangle |
getScreenRectangle(java.awt.Point p) |
static boolean |
intersectsVisibleScreen(java.awt.Window window) |
static boolean |
isMovementTowards(java.awt.Point prevLocation,
java.awt.Point location,
java.awt.Rectangle bounds) |
static boolean |
isStandardAddRemoveNotify(java.awt.Component component)
Method removeNotify (and then addNotify) will be invoked for all components when main frame switches between states "Normal" <-> "FullScreen".
|
static boolean |
isVisible(java.awt.Point location) |
static boolean |
isVisible(java.awt.Rectangle bounds) |
static void |
moveRectangleToFitTheScreen(java.awt.Rectangle aRectangle) |
static void |
moveToFit(java.awt.Rectangle rectangle,
java.awt.Rectangle container,
java.awt.Insets padding) |
public static final java.lang.String DISPOSE_TEMPORARY
public static boolean isVisible(java.awt.Point location)
public static boolean isVisible(java.awt.Rectangle bounds)
public static java.awt.Rectangle getMainScreenBounds()
public static java.awt.Shape getAllScreensShape()
public static java.awt.Rectangle getAllScreensRectangle()
public static java.awt.Rectangle getScreenRectangle(java.awt.Point p)
public static java.awt.Rectangle getScreenRectangle(java.awt.Component component)
public static java.awt.GraphicsDevice getScreenDevice(java.awt.Rectangle bounds)
bounds
- a rectangle used to find corresponding graphics devicepublic static boolean isStandardAddRemoveNotify(java.awt.Component component)
public static java.awt.Insets getScreenInsets(java.awt.GraphicsConfiguration gc)
public static java.awt.Rectangle getScreenRectangle(java.awt.GraphicsConfiguration configuration)
configuration
- one of available configurationspublic static java.awt.Rectangle getScreenRectangle(int x, int y)
x
- the X coordinate of the specified pointy
- the Y coordinate of the specified pointpublic static void moveRectangleToFitTheScreen(java.awt.Rectangle aRectangle)
public static void moveToFit(java.awt.Rectangle rectangle, java.awt.Rectangle container, java.awt.Insets padding)
public static void fitToScreenVertical(java.awt.Rectangle rectangle, int top, int bottom, boolean rightAligned)
rectangle
- the rectangle to move and resizetop
- preferred offset between rectangle.y
and popup abovebottom
- preferred offset between rectangle.y
and popup belowrightAligned
- shows that the rectangle should be moved to the leftpublic static void fitToScreen(java.awt.Rectangle r)
public static java.awt.Point findNearestPointOnBorder(java.awt.Rectangle rect, java.awt.Point p)
public static void cropRectangleToFitTheScreen(java.awt.Rectangle rect)
public static boolean isMovementTowards(java.awt.Point prevLocation, java.awt.Point location, java.awt.Rectangle bounds)
prevLocation
- - previous location on screenlocation
- - current location on screenbounds
- - area to check if location shifted towards or not. Also in screen coordinatespublic static boolean intersectsVisibleScreen(java.awt.Window window)