Package de.alpharogroup.layout
Class GraphicsDeviceExtensions
- java.lang.Object
-
- de.alpharogroup.layout.GraphicsDeviceExtensions
-
public class GraphicsDeviceExtensions extends java.lang.ObjectThe classGraphicsDeviceExtensionshelps you if the user have more than one screen to determine which screen is currently shown.
-
-
Constructor Summary
Constructors Constructor Description GraphicsDeviceExtensions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.GraphicsDevice[]getAvailableScreens()Gets the available screens.static java.util.Optional<java.awt.GraphicsDevice>getGraphicsDevice(int index)Gets theOptionalwith anGraphicsDevicein it or if it does not exist theOptionalobject is empty.static intgetGraphicsDeviceIndexIsShowingOn(java.awt.Component component)Gets the array index(in the availableGraphicsDevicearray) of the given component is showing on.static java.awt.GraphicsDevicegetGraphicsDeviceIsShowingOn(java.awt.Component component)Gets the graphics device (screen) is showing on.static booleanisScreenAvailableToShow(int screen)Checks if the given screen number is available to show.static voidshowOnScreen(int screen, javax.swing.JFrame frame)If the screen is available the givenJFramewill be show in the given screen.
-
-
-
Method Detail
-
getAvailableScreens
public static java.awt.GraphicsDevice[] getAvailableScreens()
Gets the available screens.- Returns:
- the available screens
-
getGraphicsDevice
public static java.util.Optional<java.awt.GraphicsDevice> getGraphicsDevice(int index)
Gets theOptionalwith anGraphicsDevicein it or if it does not exist theOptionalobject is empty.- Parameters:
index- the index- Returns:
- the
Optionalwith anGraphicsDevicein it or if it does not exist theOptionalobject is empty.
-
getGraphicsDeviceIndexIsShowingOn
public static int getGraphicsDeviceIndexIsShowingOn(java.awt.Component component)
Gets the array index(in the availableGraphicsDevicearray) of the given component is showing on.- Parameters:
component- the component- Returns:
- the array index(in the available
GraphicsDevicearray) of the given component is showing on.
-
getGraphicsDeviceIsShowingOn
public static java.awt.GraphicsDevice getGraphicsDeviceIsShowingOn(java.awt.Component component)
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
public static void showOnScreen(int screen, javax.swing.JFrame frame)If the screen is available the givenJFramewill be show in the given screen.- Parameters:
screen- the screen number.frame- theJFrame
-
-