public final class SystemUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
copyToClipboard(String text)
Copies text to system clipboard.
|
static GraphicsDevice |
getDefaultScreenDevice()
Returns default screen device.
|
static Rectangle |
getDeviceBounds(Component component,
boolean applyScreenInsets)
Returns screen bounds within which most part of the specified component is placed.
|
static Rectangle |
getDeviceBounds(GraphicsConfiguration gc,
boolean applyScreenInsets)
Returns screen device bounds.
|
static Rectangle |
getDeviceBounds(GraphicsDevice device,
boolean applyScreenInsets)
Returns screen device bounds.
|
static Rectangle |
getDeviceBounds(Point location,
boolean applyScreenInsets)
Returns screen bounds for the specified location.
|
static Rectangle |
getDeviceBounds(Rectangle bounds,
boolean applyScreenInsets)
Returns screen bounds within which most part of the specified bounds is placed.
|
static List<Rectangle> |
getDevicesBounds(boolean applyScreenInsets)
Returns screen device bounds for all screen devices available.
|
static GraphicsConfiguration |
getGraphicsConfiguration()
Returns default screen GraphicsConfiguration.
|
static GraphicsDevice |
getGraphicsDevice(Point location)
Returns screen device for the specified location.
|
static GraphicsDevice |
getGraphicsDevice(Rectangle bounds)
Returns screen device where most part of specified bounds is placed.
|
static GraphicsDevice |
getGraphicsDevice(Window window)
Returns screen device for the specified window.
|
static List<GraphicsDevice> |
getGraphicsDevices()
Returns list of available screen devices.
|
static GraphicsEnvironment |
getGraphicsEnvironment()
Returns default GraphicsEnvironment.
|
static String |
getJavaName()
Returns java vm name.
|
static String |
getJavaVendor()
Returns java vm vendor.
|
static JavaVersion |
getJavaVersion()
Returns java version application is running on.
|
static String |
getJavaVersionString()
Returns java version.
|
static String |
getJreArch()
Returns JRE architecture.
|
static String |
getJreArchName()
Returns JRE architecture name.
|
static Rectangle |
getMaximizedBounds(Frame frame)
Returns maximized bounds for the screen where specified frame is displayed.
|
static Rectangle |
getMaximizedEastBounds(Frame frame)
Returns maximized bounds for the east half of the screen where specified frame is displayed.
|
static Rectangle |
getMaximizedWestBounds(Frame frame)
Returns maximized bounds for the west half of the screen where specified frame is displayed.
|
static String |
getOsArch()
Returns OS architecture.
|
static Icon |
getOsIcon()
Returns OS icon.
|
static Icon |
getOsIcon(boolean color)
Returns colored or grayscale OS icon.
|
static Icon |
getOsIcon(int size)
Returns OS icon of specified size if such exists; returns 16x16 icon otherwise.
|
static Icon |
getOsIcon(int size,
boolean color)
Returns colored or grayscale OS icon of specified size if such exists; returns 16x16 icon otherwise.
|
static String |
getOsName()
Returns OS name.
|
static int |
getOsProcessors()
Returns the number of processors available to the Java virtual machine.
|
static String |
getOsSite()
Returns OS vendor site address.
|
static SystemType |
getOsType()
Returns OS type.
|
static String |
getOsVersion()
Returns OS version.
|
static String |
getShortOsName()
Returns short OS name.
|
static String |
getStringFromClipboard()
Returns string clipboard content.
|
static Cursor |
getTransparentCursor()
Returns fully transparent cursor.
|
static boolean |
isCapsLock()
Returns whether Caps Lock is on or not.
|
static boolean |
isFrameStateSupported(int state)
Returns whether or not specified frame state is supported by the OS.
|
static boolean |
isHeadlessEnvironment()
Returns whether or not a display, keyboard, and mouse can be supported in this environment.
|
static boolean |
isJava10orAbove()
Returns whether application is running on java 10 version and above or not.
|
static boolean |
isJava6orAbove()
Returns whether application is running on java 6 version and above or not.
|
static boolean |
isJava7orAbove()
Returns whether application is running on java 7 version and above or not.
|
static boolean |
isJava8orAbove()
Returns whether application is running on java 8 version and above or not.
|
static boolean |
isJava9orAbove()
Returns whether application is running on java 9 version and above or not.
|
static boolean |
isJavaVersionOrAbove(double version)
Returns whether application is running on the specified java version and above or not.
|
static boolean |
isJavaVersionOrAbove(double version,
int update)
Returns whether application is running on the specified java version and above or not.
|
static boolean |
isJavaVersionOrAbove(double major,
int minor,
int update)
Returns whether application is running on the specified java version and above or not.
|
static boolean |
isMac()
Returns whether current OS is mac or not.
|
static boolean |
isNumLock()
Returns whether Num Lock is on or not.
|
static boolean |
isScrollLock()
Returns whether Scroll Lock is on or not.
|
static boolean |
isSolaris()
Returns whether current OS is solaris or not.
|
static boolean |
isUnix()
Returns whether current OS is unix or not.
|
static boolean |
isWindows()
Returns whether current OS is windows or not.
|
public static void copyToClipboard(@Nullable String text)
text - text to copy into clipboard@Nullable public static String getStringFromClipboard()
@NotNull public static String getJavaVersionString()
@NotNull public static JavaVersion getJavaVersion()
public static boolean isJavaVersionOrAbove(double version)
version - version numbertrue if the application is running on the specified java version and above, false otherwisepublic static boolean isJavaVersionOrAbove(double version,
int update)
version - version numberupdate - update numbertrue if the application is running on the specified java version and above, false otherwisepublic static boolean isJavaVersionOrAbove(double major,
int minor,
int update)
major - major versionminor - minor versionupdate - update numbertrue if the application is running on the specified java version and above, false otherwisepublic static boolean isJava6orAbove()
true if the application is running on java 6 version and above, false otherwisepublic static boolean isJava7orAbove()
true if the application is running on java 7 version and above, false otherwisepublic static boolean isJava8orAbove()
true if the application is running on java 8 version and above, false otherwisepublic static boolean isJava9orAbove()
true if the application is running on java 9 version and above, false otherwisepublic static boolean isJava10orAbove()
true if the application is running on java 10 version and above, false otherwise@NotNull public static String getJavaVendor()
@NotNull public static Icon getOsIcon(boolean color)
color - whether return colored icon or not@NotNull public static Icon getOsIcon(int size)
size - preferred icon size@NotNull public static Icon getOsIcon(int size, boolean color)
size - preferred icon sizecolor - whether return colored icon or not@NotNull public static SystemType getOsType()
public static boolean isWindows()
true if current OS is windows, false otherwisepublic static boolean isMac()
true if current OS is mac, false otherwisepublic static boolean isUnix()
true if current OS is unix, false otherwisepublic static boolean isSolaris()
true if current OS is solaris, false otherwise@NotNull public static String getOsArch()
@NotNull public static String getShortOsName()
@NotNull public static String getOsSite()
public static int getOsProcessors()
@NotNull public static String getJreArch()
@NotNull public static String getJreArchName()
public static boolean isCapsLock()
true if Caps Lock is on, false otherwisepublic static boolean isNumLock()
true if Num Lock is on, false otherwisepublic static boolean isScrollLock()
true if Scroll Lock is on, false otherwise@NotNull public static GraphicsEnvironment getGraphicsEnvironment()
public static boolean isHeadlessEnvironment()
true if display, keyboard, and mouse can be supported in this environment, false otherwise@NotNull public static GraphicsDevice getDefaultScreenDevice()
@NotNull public static GraphicsConfiguration getGraphicsConfiguration()
@NotNull public static List<GraphicsDevice> getGraphicsDevices()
@NotNull public static GraphicsDevice getGraphicsDevice(@Nullable Window window)
window - window to find screen device for@NotNull public static GraphicsDevice getGraphicsDevice(@NotNull Point location)
location - location to find screen device for@NotNull public static GraphicsDevice getGraphicsDevice(@NotNull Rectangle bounds)
bounds - bounds to find screen device for@NotNull public static Rectangle getDeviceBounds(@Nullable GraphicsDevice device, boolean applyScreenInsets)
device - screen device to return bounds forapplyScreenInsets - whether or not should extract screen insets from graphics device bounds@NotNull public static Rectangle getDeviceBounds(@Nullable GraphicsConfiguration gc, boolean applyScreenInsets)
gc - screen device graphics configurationapplyScreenInsets - whether or not should extract screen insets from screen device bounds@NotNull public static List<Rectangle> getDevicesBounds(boolean applyScreenInsets)
applyScreenInsets - whether or not should extract screen insets from screen device bounds@NotNull public static Rectangle getDeviceBounds(@NotNull Point location, boolean applyScreenInsets)
location - location to find screen bounds forapplyScreenInsets - whether or not should extract screen insets from graphics device bounds@NotNull public static Rectangle getDeviceBounds(@NotNull Rectangle bounds, boolean applyScreenInsets)
bounds - bounds to find screen bounds forapplyScreenInsets - whether or not should extract screen insets from graphics device bounds@NotNull public static Rectangle getDeviceBounds(@NotNull Component component, boolean applyScreenInsets)
component - component to find screen bounds forapplyScreenInsets - whether or not should extract screen insets from graphics device bounds@NotNull public static Rectangle getMaximizedBounds(@NotNull Frame frame)
frame - frame to provide maximized bounds for@NotNull public static Rectangle getMaximizedWestBounds(@NotNull Frame frame)
frame - frame to provide maximized bounds for@NotNull public static Rectangle getMaximizedEastBounds(@NotNull Frame frame)
frame - frame to provide maximized bounds forpublic static boolean isFrameStateSupported(int state)
state - frame statetrue if the specified frame state is supported by the OS, false otherwiseCopyright © 2020. All rights reserved.