Module org.jpo

Class ScreenHelper

java.lang.Object
org.jpo.gui.swing.ScreenHelper

public class ScreenHelper extends Object
This class helps with screen size logic.
  • Method Details

    • getNumberOfScreenDevices

      public static int getNumberOfScreenDevices()
      This method returns the number of screen devices.
      Returns:
      The number of screen devices
    • isXinerama

      public static boolean isXinerama()
      This method returns whether the environment is a Xinerama environment
      Returns:
      True if the environment is a Xinerama environment, False if not
    • getXineramaScreenBounds

      public static Rectangle getXineramaScreenBounds()
      This method returns the bounds of the multihead desktop that a user may have. This method uses some code I got off the web to determine the rectangle of the screen size. This is more complicated than it appears on the face of it because some users have multiple screens making up a large virtual desktop so the top left corner is not necessarily (0,0).
      Returns:
      A rectangle with the coordinates of the desktop.
    • getPrimaryScreenBounds

      public static Rectangle getPrimaryScreenBounds()
      Returns the bounds of the primary screen
      Returns:
      The bounds of the primary screen
    • getSecondaryScreenBounds

      public static Rectangle getSecondaryScreenBounds()
      Returns the graphics Configuration of the secondary screen
      Returns:
      GraphicsConfiguration
    • getFullScreenBounds

      public static Rectangle getFullScreenBounds()
      Returns the bounds for the full screen. In a Xinerama context this is the full Xinerama area. If there is a secondary device we will use this. Otherwise, the primary.
      Returns:
      bounds for the full screen
    • getLeftScreenBounds

      public static Rectangle getLeftScreenBounds()
      Returns the bounds for the "left" window. In a Xinerama context this is the screen device with the lowest x coordinates. In a non Xinerama context this is the primary screen.
      Returns:
      bounds for the left window
    • getRightScreenBounds

      public static Rectangle getRightScreenBounds()
      Returns the bounds for the "right" window. In a Xinerama context this is the screen we assume that the screens are same sized, so we subtract a screen width from the right edge and hope this is the correct location In a non Xinerama context this is the secondary screen.
      Returns:
      bounds of the right screen
    • getTopLeftScreenBounds

      public static Rectangle getTopLeftScreenBounds()
      Returns the bounds for the "top left" window.
      Returns:
      the bounds for the top left window
    • getBottomLeftScreenBounds

      public static Rectangle getBottomLeftScreenBounds()
      Returns the bounds for the "bottom left" window.
      Returns:
      the bounds for the bottom left window
    • getTopRightScreenBounds

      public static Rectangle getTopRightScreenBounds()
      Returns the bounds for the "top right" window.
      Returns:
      the bounds for the top right window
    • getBottomRightScreenBounds

      public static Rectangle getBottomRightScreenBounds()
      Returns the bounds for the "bottom right" window.
      Returns:
      the bounds for the bottom right window
    • explainGraphicsEnvironment

      public static StringBuilder explainGraphicsEnvironment()
      Explains the graphics configuration to the log file if debug is on:
      Returns:
      A description of the graphics configuration
    • explainDisplayMode

      public static void explainDisplayMode(String id, DisplayMode displayMode)
      Explains the display mode to the log file
      Parameters:
      id - Id
      displayMode - DisplayMode
    • explainGraphicsConfiguration

      public static void explainGraphicsConfiguration(String id, GraphicsConfiguration graphicsConfiguration)
      Explains the graphics configuration to the log file
      Parameters:
      id - Id
      graphicsConfiguration - GraphicsConfiguration