Class GraphicsDeviceExtensions

java.lang.Object
io.github.astrapi69.awt.screen.GraphicsDeviceExtensions

public final class GraphicsDeviceExtensions extends Object
The class GraphicsDeviceExtensions helps you if the user has more than one screen to determine which screen is currently shown.
  • Method Details

    • getAvailableScreens

      public static GraphicsDevice[] getAvailableScreens()
      Gets the available screens.
      Returns:
      the available screens
    • getGraphicsDevice

      public static Optional<GraphicsDevice> getGraphicsDevice(int index)
      Gets the Optional with an GraphicsDevice in it or if it does not exist the Optional object is empty.
      Parameters:
      index - the index
      Returns:
      the Optional with an GraphicsDevice in it or if it does not exist the Optional object is empty.
    • getGraphicsDeviceIndexIsShowingOn

      public static int getGraphicsDeviceIndexIsShowingOn(Component component)
      Gets the array index(in the available GraphicsDevice 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

      public static GraphicsDevice getGraphicsDeviceIsShowingOn(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 <T extends Window> void showOnScreen(int screen, T window)
      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