Package io.github.astrapi69.awt.screen
Class GraphicsDeviceExtensions
java.lang.Object
io.github.astrapi69.awt.screen.GraphicsDeviceExtensions
The class
GraphicsDeviceExtensions
helps you if the user has more than one screen to
determine which screen is currently shown.-
Method Summary
Modifier and TypeMethodDescriptionstatic GraphicsDevice[]
Gets the available screens.static Optional<GraphicsDevice>
getGraphicsDevice
(int index) Gets theOptional
with anGraphicsDevice
in it or if it does not exist theOptional
object is empty.static int
getGraphicsDeviceIndexIsShowingOn
(Component component) Gets the array index(in the availableGraphicsDevice
array) of the given component is showing on.static GraphicsDevice
getGraphicsDeviceIsShowingOn
(Component component) Gets the graphics device (screen) is showing on.static boolean
isScreenAvailableToShow
(int screen) Checks if the given screen number is available to show.static <T extends Window>
voidshowOnScreen
(int screen, T window) If the screen is available, the given window will be shown in the given screen
-
Method Details
-
getAvailableScreens
Gets the available screens.- Returns:
- the available screens
-
getGraphicsDevice
Gets theOptional
with anGraphicsDevice
in it or if it does not exist theOptional
object is empty.- Parameters:
index
- the index- Returns:
- the
Optional
with anGraphicsDevice
in it or if it does not exist theOptional
object is empty.
-
getGraphicsDeviceIndexIsShowingOn
Gets the array index(in the availableGraphicsDevice
array) of the given component is showing on.- Parameters:
component
- the component- Returns:
- the array index(in the available
GraphicsDevice
array) of the given component is showing on.
-
getGraphicsDeviceIsShowingOn
Gets the graphics device (screen) is showing on.- Parameters:
component
- the component- Returns:
- the graphics device is showing on
-
isScreenAvailableToShow
public static boolean isScreenAvailableToShow(int screen) Checks if the given screen number is available to show.- Parameters:
screen
- the screen- Returns:
- true, if is screen available to show
-
showOnScreen
If the screen is available, the given window will be shown in the given screen- Type Parameters:
T
- the generic type of the window- Parameters:
screen
- the screen number.window
- the window
-