public class Platform
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAC
Indicates that the system is some variety of Apple Macintosh.
|
static int |
UNIX
Indicates that the system is some variety of Unix or Linux.
|
static int |
UNKNOWN
Indicates that the type of system cannot be determined.
|
static int |
WINDOWS
Indicates that the system is some variety of Microsoft Windows.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areCollectionsAvailable()
Checks whether the JDK 1.2 collection classes are available.
|
static boolean |
areStandardFontFamiliesAvailable()
Checks whether the JDK 1.2 standard font families (
Serif ,
SansSerif , and Monospaced ) are available. |
static int |
compareVersion(java.lang.String version)
This method compares the Java version given in the system properties with the
specified version and returns -1, 0, or +1 depending on whether the system
version is earlier than, equal to, or later than the specified one.
|
static int |
compareVersion(java.lang.String v1,
java.lang.String v2)
This method compares the version strings
v1 and v2
and returns -1, 0, or +1 depending on whether v1 is earlier
than, equal to, or later than v2 . |
static void |
copyFileTypeAndCreator(java.io.File oldFile,
java.io.File newFile)
Sets the Macintosh file type and creator for the new file using the old file
as a model.
|
static java.lang.String |
getJTFVersion()
Returns the version number of the JTF libraries as a string suitable for use
with the
compareVersion method. |
static int |
getPlatform()
Returns an enumeration constant specifying the type of platform on which this
applet is running, which is one of the supported types defined at the
beginning of this class.
|
static boolean |
isJMFAvailable()
Checks whether the Java Media Framework is available.
|
static boolean |
isMac()
Checks whether the platform is a Macintosh.
|
static boolean |
isSunAudioAvailable()
Checks whether the
sun.audio package is available. |
static boolean |
isSwingAvailable()
Checks whether Swing is available.
|
static boolean |
isUnix()
Checks whether the platform is Unix.
|
static boolean |
isWindows()
Checks whether the platform is a Windows machine.
|
static void |
setFileTypeAndCreator(java.io.File file,
java.lang.String type,
java.lang.String creator)
Sets the Macintosh file type and creator.
|
static void |
setFileTypeAndCreator(java.lang.String filename,
java.lang.String type,
java.lang.String creator)
Sets the Macintosh file type and creator.
|
public static final int UNKNOWN
public static final int MAC
public static final int UNIX
public static final int WINDOWS
public static int getPlatform()
public static boolean isMac()
true
if the platform is a Macintosh, false
otherwisepublic static boolean isWindows()
true
if the platform is a Windows machine,
false
otherwisepublic static boolean isUnix()
true
if the platform is Unix, false
otherwisepublic static void setFileTypeAndCreator(java.lang.String filename, java.lang.String type, java.lang.String creator)
filename
- The name of the filetype
- A four-character string indicating the file typecreator
- A four-character string indicating the file typepublic static void setFileTypeAndCreator(java.io.File file, java.lang.String type, java.lang.String creator)
file
- The File
object corresponding to the filetype
- A four-character string indicating the file typecreator
- A four-character string indicating the file typepublic static void copyFileTypeAndCreator(java.io.File oldFile, java.io.File newFile)
oldFile
- The File
object corresponding to the existing
filenewFile
- The File
object corresponding to the new filepublic static java.lang.String getJTFVersion()
compareVersion
method. Note that this returns the value
of the version of the library that is actually loaded. Making this a constant
would mean that the value would be the one with which the code was compiled,
which is less likely to be useful.public static int compareVersion(java.lang.String version)
if (Platform.compareVersion("1.2.1") >= 0) . . .
version
- A string consisting of integers separated by periodspublic static int compareVersion(java.lang.String v1, java.lang.String v2)
v1
and v2
and returns -1, 0, or +1 depending on whether v1
is earlier
than, equal to, or later than v2
.v1
- A string consisting of integers separated by periodsv2
- A second version string in the same formatv1
is earlier than,
equal to, or later than v2
public static boolean isSwingAvailable()
JComponent
class. Checking the version first
means that no SecurityException
sSecurityException
strue
if Swing is available, false
otherwisepublic static boolean isSunAudioAvailable()
sun.audio
package is available.true
if the sun.audio
package is available,
false
otherwisepublic static boolean isJMFAvailable()
true
if the JMF package is available, false
otherwisepublic static boolean areCollectionsAvailable()
ArrayList
class.true
if collections are available, false
otherwisepublic static boolean areStandardFontFamiliesAvailable()
Serif
,
SansSerif
, and Monospaced
) are available.true
if the standard fonts are available,
false
otherwise