Class ScreenSizeExtensions


  • public class ScreenSizeExtensions
    extends java.lang.Object
    Utility class for handle with screensize.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.awt.Point> computeDialogPositions​(int dialogWidth, int dialogHeight)
      Compute how much dialog can be put into the screen and returns a list with the coordinates from the dialog positions as Point objects.
      static int getFirstScreenHeight()
      Gets the first screen width.
      static int getFirstScreenWidth()
      Gets the first screen width.
      static java.awt.Point getPoint()
      Gets the Screensize and returns it as a Point object.
      static java.awt.GraphicsDevice[] getScreenDevices()
      Gets all the screen devices.
      static java.awt.Dimension getScreenDimension​(java.awt.Component component)
      Gets the screen dimension.
      static int getScreenHeight()
      Gets the height from the current screen.
      static int getScreenHeight​(java.awt.Component component)
      Gets the screen height of the GraphicsDevice that is displayed from the given component
      static int getScreenHeight​(java.awt.GraphicsDevice graphicsDevice)
      Gets the screen height from the given GraphicsDevice object.
      static int getScreenID​(java.awt.Component component)
      Gets the screen ID from the given component
      static int getScreenWidth()
      Gets the width from the current screen.
      static int getScreenWidth​(java.awt.Component component)
      Gets the screen width of the GraphicsDevice that is displayed from the given component
      static int getScreenWidth​(java.awt.GraphicsDevice graphicsDevice)
      Gets the screen width from the given GraphicsDevice object.
      static void toggleFullScreen​(@NonNull javax.swing.JFrame frame)
      Toggle full screen.
      • Methods inherited from class java.lang.Object

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

      • ScreenSizeExtensions

        public ScreenSizeExtensions()
    • Method Detail

      • computeDialogPositions

        public static java.util.List<java.awt.Point> computeDialogPositions​(int dialogWidth,
                                                                            int dialogHeight)
        Compute how much dialog can be put into the screen and returns a list with the coordinates from the dialog positions as Point objects.
        Parameters:
        dialogWidth - the dialog width
        dialogHeight - the dialog height
        Returns:
        the list with the computed Point objects.
      • getFirstScreenHeight

        public static int getFirstScreenHeight()
        Gets the first screen width.
        Returns:
        the first screen width.
      • getFirstScreenWidth

        public static int getFirstScreenWidth()
        Gets the first screen width.
        Returns:
        the first screen width.
      • getPoint

        public static java.awt.Point getPoint()
        Gets the Screensize and returns it as a Point object.
        Returns:
        A Point object.
      • getScreenDevices

        public static java.awt.GraphicsDevice[] getScreenDevices()
        Gets all the screen devices.
        Returns:
        the screen devices
      • getScreenDimension

        public static java.awt.Dimension getScreenDimension​(java.awt.Component component)
        Gets the screen dimension.
        Parameters:
        component - the component
        Returns:
        the screen dimension
      • getScreenHeight

        public static int getScreenHeight()
        Gets the height from the current screen.
        Returns:
        Returns the height from the current screen.
      • getScreenHeight

        public static int getScreenHeight​(java.awt.Component component)
        Gets the screen height of the GraphicsDevice that is displayed from the given component
        Parameters:
        component - the component
        Returns:
        the screen height
      • getScreenHeight

        public static int getScreenHeight​(java.awt.GraphicsDevice graphicsDevice)
        Gets the screen height from the given GraphicsDevice object.
        Parameters:
        graphicsDevice - the GraphicsDevice object.
        Returns:
        the screen height from the given GraphicsDevice object.
      • getScreenID

        public static int getScreenID​(java.awt.Component component)
        Gets the screen ID from the given component
        Parameters:
        component - the component
        Returns:
        the screen ID
      • getScreenWidth

        public static int getScreenWidth()
        Gets the width from the current screen.
        Returns:
        Returns the width from the current screen.
      • getScreenWidth

        public static int getScreenWidth​(java.awt.Component component)
        Gets the screen width of the GraphicsDevice that is displayed from the given component
        Parameters:
        component - the component
        Returns:
        the screen width
      • getScreenWidth

        public static int getScreenWidth​(java.awt.GraphicsDevice graphicsDevice)
        Gets the screen width from the given GraphicsDevice object.
        Parameters:
        graphicsDevice - the GraphicsDevice object.
        Returns:
        the screen width from the given GraphicsDevice object.
      • toggleFullScreen

        public static void toggleFullScreen​(@NonNull
                                            @NonNull javax.swing.JFrame frame)
        Toggle full screen.
        Parameters:
        frame - the frame