|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.util.Platform
public class Platform
This class contains methods to support platform-specific code.
Field Summary | |
---|---|
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. |
Method Summary | |
---|---|
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(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(String v1,
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(File oldFile,
File newFile)
Sets the Macintosh file type and creator for the new file using the old file as a model. |
static 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(File file,
String type,
String creator)
Sets the Macintosh file type and creator. |
static void |
setFileTypeAndCreator(String filename,
String type,
String creator)
Sets the Macintosh file type and creator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAC
public static final int UNIX
public static final int UNKNOWN
public static final int WINDOWS
Method Detail |
---|
public 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
otherwisepublic static int compareVersion(String version)
if (Platform.compareVersion("1.2.1") >= 0) . . .
version
- A string consisting of integers separated by periods
public static int compareVersion(String v1, 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 format
v1
is earlier than,
equal to, or later than v2
public static void copyFileTypeAndCreator(File oldFile, File newFile)
oldFile
- The File
object corresponding to the existing filenewFile
- The File
object corresponding to the new filepublic static 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 getPlatform()
public static boolean isJMFAvailable()
true
if the JMF package is available, false
otherwisepublic static boolean isMac()
true
if the platform is a Macintosh, false
otherwisepublic static boolean isSunAudioAvailable()
sun.audio
package is available.
true
if the sun.audio
package is available,
false
otherwisepublic static boolean isSwingAvailable()
JComponent
class. Checking the version first
means that no SecurityException
sSecurityException
s
true
if Swing is available, false
otherwisepublic static boolean isUnix()
true
if the platform is Unix, false
otherwisepublic static boolean isWindows()
true
if the platform is a Windows machine, false
otherwisepublic static void setFileTypeAndCreator(File file, String type, 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 setFileTypeAndCreator(String filename, String type, String creator)
filename
- The name of the filetype
- A four-character string indicating the file typecreator
- A four-character string indicating the file type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |