Package io.github.astrapi69.awt.screen
Class ScreenSizeExtensions
java.lang.Object
io.github.astrapi69.awt.screen.ScreenSizeExtensions
Utility class for handle with screensize.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
centralize
(@NonNull Component component, int divideScreenWith, int divideScreenHeight) Set givenWindow
to the center of the device and divide them with the given argumentsstatic void
centralize
(@NonNull Window window, int divideScreenWith, int divideScreenHeight) Set givenWindow
to the center of the device and divide them with the given argumentscomputeDialogPositions
(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
Gets the first screen width.static int
Gets the first screen width.static GraphicsConfiguration
getGraphicsConfiguration
(int screenID) Gets theGraphicsConfiguration
from the given screen idstatic Point
getPoint()
Gets the Screensize and returns it as a Point object.static GraphicsDevice
getScreenDevice
(int screenID) Gets the screen device from the given screen idstatic GraphicsDevice[]
Gets all the screen devices.static Dimension
getScreenDimension
(Component component) Gets the screen dimension.static int
Gets the height from the current screen.static int
getScreenHeight
(Component component) Gets the screen height of theGraphicsDevice
that is displayed from the given componentstatic double
getScreenHeight
(GraphicsConfiguration graphicsConfiguration) Gets the screen width from the givenGraphicsConfiguration
objectstatic int
getScreenHeight
(GraphicsDevice graphicsDevice) Gets the screen height from the givenGraphicsDevice
object.static int
getScreenID
(Component component) Gets the screen ID from the given componentstatic Dimension
Gets theDimension
object from the current screen sizestatic int
Gets the width from the current screen.static int
getScreenWidth
(Component component) Gets the screen width of theGraphicsDevice
that is displayed from the given componentstatic double
getScreenWidth
(GraphicsConfiguration graphicsConfiguration) Gets the screen width from the givenGraphicsConfiguration
objectstatic int
getScreenWidth
(GraphicsDevice graphicsDevice) Gets the screen width from the givenGraphicsDevice
object.static void
Maximizes the givenWindow
from the given componentstatic void
Maximizes the givenWindow
static void
setComponentPosition
(Component component, ComponentPositionModel componentPositionModel) Positions the given window from the given position modelstatic void
setDefaultFrameSize
(@NonNull Frame frame) Sets the default sceen size from the givenFrame
static void
Bring the givenFrame
to the frontstatic void
toggleFullScreen
(@NonNull JFrame frame) Toggle givenFrame
to full screen mode or if it is in full screen mode its returns to normal mode
-
Method Details
-
maximize
Maximizes the givenWindow
from the given component- Parameters:
component
- the component
-
maximize
Maximizes the givenWindow
- Parameters:
window
- the window
-
centralize
public static void centralize(@NonNull @NonNull Component component, int divideScreenWith, int divideScreenHeight) Set givenWindow
to the center of the device and divide them with the given arguments- Parameters:
component
- the componentdivideScreenWith
- the value to divide with the screen withdivideScreenHeight
- the value to divide with the screen height
-
centralize
public static void centralize(@NonNull @NonNull Window window, int divideScreenWith, int divideScreenHeight) Set givenWindow
to the center of the device and divide them with the given arguments- Parameters:
window
- the windowdivideScreenWith
- the value to divide with the screen withdivideScreenHeight
- the value to divide with the screen height
-
computeDialogPositions
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 widthdialogHeight
- 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.
-
getGraphicsConfiguration
Gets theGraphicsConfiguration
from the given screen id- Parameters:
screenID
- the screen id- Returns:
- the
GraphicsConfiguration
object from the given screen id
-
getPoint
Gets the Screensize and returns it as a Point object.- Returns:
- A Point object.
-
getScreenDevice
Gets the screen device from the given screen id- Parameters:
screenID
- the screen id- Returns:
- the
GraphicsDevice
object from the given screen id
-
getScreenDevices
Gets all the screen devices.- Returns:
- the screen devices
-
getScreenDimension
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.
-
getScreenSizeDimension
Gets theDimension
object from the current screen size- Returns:
- Returns the
Dimension
object from the current screen size
-
getScreenHeight
Gets the screen height of theGraphicsDevice
that is displayed from the given component- Parameters:
component
- the component- Returns:
- the screen height
-
getScreenHeight
Gets the screen width from the givenGraphicsConfiguration
object- Parameters:
graphicsConfiguration
- the graphic configuration object- Returns:
- the screen width.
-
getScreenHeight
Gets the screen height from the givenGraphicsDevice
object.- Parameters:
graphicsDevice
- theGraphicsDevice
object.- Returns:
- the screen height from the given
GraphicsDevice
object.
-
getScreenID
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
Gets the screen width of theGraphicsDevice
that is displayed from the given component- Parameters:
component
- the component- Returns:
- the screen width
-
getScreenWidth
Gets the screen width from the givenGraphicsConfiguration
object- Parameters:
graphicsConfiguration
- the graphic configuration object- Returns:
- the screen width.
-
getScreenWidth
Gets the screen width from the givenGraphicsDevice
object.- Parameters:
graphicsDevice
- theGraphicsDevice
object.- Returns:
- the screen width from the given
GraphicsDevice
object.
-
showFrame
Bring the givenFrame
to the front- Parameters:
frame
- the frame
-
setDefaultFrameSize
Sets the default sceen size from the givenFrame
- Parameters:
frame
- the frame
-
toggleFullScreen
Toggle givenFrame
to full screen mode or if it is in full screen mode its returns to normal mode- Parameters:
frame
- the frame
-
setComponentPosition
public static void setComponentPosition(Component component, ComponentPositionModel componentPositionModel) Positions the given window from the given position model- Parameters:
component
- the windowcomponentPositionModel
- the window position model
-