java.lang.Object
org.jpo.gui.swing.ScreenHelper
This class helps with screen size logic.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidexplainDisplayMode(String id, DisplayMode displayMode) Explains the display mode to the log filestatic voidexplainGraphicsConfiguration(String id, GraphicsConfiguration graphicsConfiguration) Explains the graphics configuration to the log filestatic StringBuilderExplains the graphics configuration to the log file if debug is on:static RectangleReturns the bounds for the "bottom left" window.static RectangleReturns the bounds for the "bottom right" window.static RectangleReturns the bounds for the full screen.static RectangleReturns the bounds for the "left" window.static intThis method returns the number of screen devices.static RectangleReturns the bounds of the primary screenstatic RectangleReturns the bounds for the "right" window.static RectangleReturns the graphics Configuration of the secondary screenstatic RectangleReturns the bounds for the "top left" window.static RectangleReturns the bounds for the "top right" window.static RectangleThis method returns the bounds of the multihead desktop that a user may have.static booleanThis method returns whether the environment is a Xinerama environment
-
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
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
Returns the bounds of the primary screen- Returns:
- The bounds of the primary screen
-
getSecondaryScreenBounds
Returns the graphics Configuration of the secondary screen- Returns:
- GraphicsConfiguration
-
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
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
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
Returns the bounds for the "top left" window.- Returns:
- the bounds for the top left window
-
getBottomLeftScreenBounds
Returns the bounds for the "bottom left" window.- Returns:
- the bounds for the bottom left window
-
getTopRightScreenBounds
Returns the bounds for the "top right" window.- Returns:
- the bounds for the top right window
-
getBottomRightScreenBounds
Returns the bounds for the "bottom right" window.- Returns:
- the bounds for the bottom right window
-
explainGraphicsEnvironment
Explains the graphics configuration to the log file if debug is on:- Returns:
- A description of the graphics configuration
-
explainDisplayMode
Explains the display mode to the log file- Parameters:
id- IddisplayMode- DisplayMode
-
explainGraphicsConfiguration
public static void explainGraphicsConfiguration(String id, GraphicsConfiguration graphicsConfiguration) Explains the graphics configuration to the log file- Parameters:
id- IdgraphicsConfiguration- GraphicsConfiguration
-