public class MacOSUtilities extends java.lang.Object
Modified by: Joseph A. Huwaldt
Constructor and Description |
---|
MacOSUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
copyCreatorType(java.io.File input,
java.io.File output)
Converts an output file's type and creator codes to match the input
file's.
|
static java.io.File |
getPreferenceFile(java.lang.String prefix)
Method that returns a File reference to a preference file for this application.
|
static java.io.File |
getProxyIcon(javax.swing.JFrame window)
Return the contents of the "Window.documentFile" client property (which can
return null).
|
static java.io.File |
getResource(java.lang.String resourceName,
java.lang.String defaultAppName)
Returns the a File reference to the specified resource in the MacOS X application
bundle's Resource directory.
|
static java.io.File |
getResource(java.lang.String resourceName,
java.lang.String subDirName,
java.lang.String defaultAppName)
Returns the a File reference to the specified resource in the specified
sub-directory of the application bundle's Resource directory.
|
static boolean |
isMacOS()
Returns true if this program is running in any MacOS 8/9/X environment,
false is returned otherwise.
|
static boolean |
isMacOSClassic()
Returns true if this program is running in a MacOS 8/9 environment,
false is returned otherwise.
|
static boolean |
isMacOSX()
Returns true if this program is running in a MacOS X environment,
false is returned otherwise.
|
static java.lang.Boolean |
isMarkedModified(javax.swing.JFrame window)
Return the state of the "Window.documentModified" client property for the specified
frame.
|
static void |
setCreatorType(java.io.File file,
java.lang.String creator,
java.lang.String type)
Sets the specified file to the specified MacOS creator and type.
|
static void |
setModifiedMark(javax.swing.JFrame window,
boolean modified)
Sets the "Window.documentModified" client property on the frame's root pane to the
value indicated.
|
static void |
setProxyIcon(javax.swing.JFrame window,
java.io.File file)
Set's the title bar proxy icon.
|
public MacOSUtilities()
public static boolean isMacOS()
public static boolean isMacOSClassic()
public static boolean isMacOSX()
public static void copyCreatorType(java.io.File input, java.io.File output) throws java.io.IOException
input
- The file the creator and type code will be copied from.output
- The file that will by given the creator and type code.java.io.IOException
public static void setCreatorType(java.io.File file, java.lang.String creator, java.lang.String type) throws java.io.IOException
file
- The file to have it's type and creator set.creator
- The creator code to set this file to.type
- The type code to set this file to.java.io.IOException
public static java.io.File getResource(java.lang.String resourceName, java.lang.String defaultAppName) throws java.io.FileNotFoundException
resourceName
- The name of the resource file.defaultAppName
- The default application name to use if not running on MacOS.java.io.FileNotFoundException
- if the specified resource file could not be found.public static java.io.File getResource(java.lang.String resourceName, java.lang.String subDirName, java.lang.String defaultAppName) throws java.io.FileNotFoundException
resourceName
- The name of the resource file.subDirName
- The name of the sub-directory under Resources.defaultAppName
- The default application name to use if not running on MacOS.java.io.FileNotFoundException
- if the specified resource file could not be found.public static java.io.File getPreferenceFile(java.lang.String prefix)
prefix
- The name of the preference file to use (".properties" will be appended automatically).public static void setModifiedMark(javax.swing.JFrame window, boolean modified)
modified
is set to true.window
- The JFrame to have the modified mark set on.modified
- Set to true to indicate that the document represented by frame is
modified. Set to false to indicate that it has not been modified since it was last
created, read in, or saved.public static java.lang.Boolean isMarkedModified(javax.swing.JFrame window)
window
- The frame to have the document modified client property read from.public static void setProxyIcon(javax.swing.JFrame window, java.io.File file)
window
- The JFrame to have a proxy icon added to the title bar.file
- The file who's icon should be added to the title bar. The Mac
automatically finds the correct icon for the file or folder.public static java.io.File getProxyIcon(javax.swing.JFrame window)
window
- The JFrame to have the proxy icon file retrieved.