com.alee.utils
Class SystemUtils

java.lang.Object
  extended by com.alee.utils.SystemUtils

public final class SystemUtils
extends java.lang.Object

This class provides a set of utilities to retrieve various operating system information. Futher on operating system called shortly - OS.

Author:
Mikle Garin

Field Summary
static java.lang.String MAC
          Mac OS short name.
static java.lang.String SOLARIS
          Solaris short name.
static java.lang.String UNIX
          Unix short name.
static java.lang.String WINDOWS
          Windows short name.
 
Constructor Summary
SystemUtils()
           
 
Method Summary
static void copyToClipboard(java.lang.String text)
          Copies text to system clipboard.
static java.awt.GraphicsConfiguration getGraphicsConfiguration()
          Returns default GraphicsConfiguration for main screen.
static java.util.List<java.awt.GraphicsDevice> getGraphicsDevices()
          Returns list of available screen devices.
static java.lang.String getJavaName()
          Returns java vm name.
static java.lang.String getJavaVendor()
          Returns java vm vendor.
static JavaVersion getJavaVersion()
          Returns java version application is running on.
static java.lang.String getJavaVersionString()
          Returns java version.
static java.lang.String getJreArch()
          Returns JRE architecture.
static java.lang.String getJreArchName()
          Returns JRE architecture name.
static java.lang.String getOsArch()
          Returns OS architecture.
static javax.swing.ImageIcon getOsIcon()
          Returns OS icon.
static javax.swing.ImageIcon getOsIcon(boolean color)
          Returns colored or grayscale OS icon.
static javax.swing.ImageIcon getOsIcon(int size)
          Returns OS icon of specified size if such exists; returns 16x16 icon otherwise.
static javax.swing.ImageIcon getOsIcon(int size, boolean color)
          Returns colored or grayscale OS icon of specified size if such exists; returns 16x16 icon otherwise.
static java.lang.String getOsName()
          Returns OS name.
static int getOsProcessors()
          Returns the number of processors available to the Java virtual machine.
static java.lang.String getOsSite()
           
static java.lang.String getOsVersion()
          Returns OS version.
static java.lang.String getShortOsName()
          Returns short OS name.
static java.lang.String getStringFromClipboard()
          Returns string clipboard content.
static java.awt.Cursor getTransparentCursor()
           
static boolean isCapsLock()
          Returns whether Caps Lock is on or not.
static boolean isJava6orAbove()
          Returns whether applicaton is running on java 6 version and above or not.
static boolean isJava7orAbove()
          Returns whether applicaton is running on java 7 version and above or not.
static boolean isJava8orAbove()
          Returns whether applicaton is running on java 8 version and above or not.
static boolean isJavaVersion(double version, int update)
          Returns whether applicaton is running on the specified java version and above or not.
static boolean isJavaVersion(double major, int minor, int update)
          Returns whether applicaton 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WINDOWS

public static final java.lang.String WINDOWS
Windows short name.

See Also:
Constant Field Values

MAC

public static final java.lang.String MAC
Mac OS short name.

See Also:
Constant Field Values

UNIX

public static final java.lang.String UNIX
Unix short name.

See Also:
Constant Field Values

SOLARIS

public static final java.lang.String SOLARIS
Solaris short name.

See Also:
Constant Field Values
Constructor Detail

SystemUtils

public SystemUtils()
Method Detail

copyToClipboard

public static void copyToClipboard(java.lang.String text)
Copies text to system clipboard.

Parameters:
text - text to copy into clipboard

getStringFromClipboard

public static java.lang.String getStringFromClipboard()
Returns string clipboard content.

Returns:
string clipboard content

getJavaVersionString

public static java.lang.String getJavaVersionString()
Returns java version.

Returns:
java version

getJavaVersion

public static JavaVersion getJavaVersion()
Returns java version application is running on.

Returns:
java version application is running on

isJavaVersion

public static boolean isJavaVersion(double version,
                                    int update)
Returns whether applicaton is running on the specified java version and above or not.

Returns:
true if the application is running on the specified java version and above, false otherwise

isJavaVersion

public static boolean isJavaVersion(double major,
                                    int minor,
                                    int update)
Returns whether applicaton is running on the specified java version and above or not.

Returns:
true if the application is running on the specified java version and above, false otherwise

isJava6orAbove

public static boolean isJava6orAbove()
Returns whether applicaton is running on java 6 version and above or not.

Returns:
true if the application is running on java 6 version and above, false otherwise

isJava7orAbove

public static boolean isJava7orAbove()
Returns whether applicaton is running on java 7 version and above or not.

Returns:
true if the application is running on java 7 version and above, false otherwise

isJava8orAbove

public static boolean isJava8orAbove()
Returns whether applicaton is running on java 8 version and above or not.

Returns:
true if the application is running on java 8 version and above, false otherwise

getJavaName

public static java.lang.String getJavaName()
Returns java vm name.

Returns:
java vm name

getJavaVendor

public static java.lang.String getJavaVendor()
Returns java vm vendor.

Returns:
java vm vendor

getShortOsName

public static java.lang.String getShortOsName()
Returns short OS name.

Returns:
short OS name

getOsIcon

public static javax.swing.ImageIcon getOsIcon()
Returns OS icon.

Returns:
OS icon

getOsIcon

public static javax.swing.ImageIcon getOsIcon(boolean color)
Returns colored or grayscale OS icon.

Parameters:
color - whether return colored icon or not
Returns:
OS icon

getOsIcon

public static javax.swing.ImageIcon getOsIcon(int size)
Returns OS icon of specified size if such exists; returns 16x16 icon otherwise.

Parameters:
size - preferred icon size
Returns:
OS icon

getOsIcon

public static javax.swing.ImageIcon getOsIcon(int size,
                                              boolean color)
Returns colored or grayscale OS icon of specified size if such exists; returns 16x16 icon otherwise.

Parameters:
size - preferred icon size
color - whether return colored icon or not
Returns:
OS icon

isWindows

public static boolean isWindows()
Returns whether current OS is windows or not.

Returns:
true if current OS is windows, false otherwise

isMac

public static boolean isMac()
Returns whether current OS is mac or not.

Returns:
true if current OS is mac, false otherwise

isUnix

public static boolean isUnix()
Returns whether current OS is unix or not.

Returns:
true if current OS is unix, false otherwise

isSolaris

public static boolean isSolaris()
Returns whether current OS is solaris or not.

Returns:
true if current OS is solaris, false otherwise

getOsArch

public static java.lang.String getOsArch()
Returns OS architecture.

Returns:
OS architecture

getOsName

public static java.lang.String getOsName()
Returns OS name.

Returns:
OS name

getOsSite

public static java.lang.String getOsSite()

getOsVersion

public static java.lang.String getOsVersion()
Returns OS version.

Returns:
OS version

getOsProcessors

public static int getOsProcessors()
Returns the number of processors available to the Java virtual machine.

Returns:
number of processors

getJreArch

public static java.lang.String getJreArch()
Returns JRE architecture.

Returns:
JRE architecture

getJreArchName

public static java.lang.String getJreArchName()
Returns JRE architecture name.

Returns:
JRE architecture name

isCapsLock

public static boolean isCapsLock()
Returns whether Caps Lock is on or not.

Returns:
true if Caps Lock is on, false otherwise

isNumLock

public static boolean isNumLock()
Returns whether Num Lock is on or not.

Returns:
true if Num Lock is on, false otherwise

isScrollLock

public static boolean isScrollLock()
Returns whether Scroll Lock is on or not.

Returns:
true if Scroll Lock is on, false otherwise

getGraphicsConfiguration

public static java.awt.GraphicsConfiguration getGraphicsConfiguration()
Returns default GraphicsConfiguration for main screen.

Returns:
mail scren GraphicsConfiguration

getGraphicsDevices

public static java.util.List<java.awt.GraphicsDevice> getGraphicsDevices()
Returns list of available screen devices.

Returns:
list of available screen devices

getTransparentCursor

public static java.awt.Cursor getTransparentCursor()