Class GraphicsDeviceExtensions


  • public class GraphicsDeviceExtensions
    extends java.lang.Object
    The class GraphicsDeviceExtensions helps you if the user have more than one screen to determine which screen is currently shown.
    • 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 the Optional with an GraphicsDevice in it or if it does not exist the Optional object is empty.
      static int getGraphicsDeviceIndexIsShowingOn​(java.awt.Component component)
      Gets the array index(in the available GraphicsDevice array) of the given component is showing on.
      static java.awt.GraphicsDevice getGraphicsDeviceIsShowingOn​(java.awt.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 void showOnScreen​(int screen, javax.swing.JFrame frame)
      If the screen is available the given JFrame will be show in the given screen.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GraphicsDeviceExtensions

        public GraphicsDeviceExtensions()
    • 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 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​(java.awt.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 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 given JFrame will be show in the given screen.
        Parameters:
        screen - the screen number.
        frame - the JFrame