Chapter 1 - Using MRJToolkit
Although most Java code can run unchanged on multiple host platforms, in some cases you might want to access certain platform-specific functions. MRJToolkit allows Java code limited access to the Mac OS platform. Specifically, it allows you to do any of the following from your Java code:
Allowing access to the Mac OS platform means that your Java application becomes platform-specific. However, since calls to MRJToolkit do nothing if the appropriate implementations are not available, you can still easily adapt your Java application to work on different platforms.
- Set or read special file identifiers (file types and creators) that are used by the Mac OS Finder
- Determine paths to special Mac OS folders, such as the Preferences folder or the Desktop folder
- Respond to simple system events such as requests to open a file, to print, or to quit
- Implement an About box that can be activated from the Apple menu, as Mac OS users expect
- Create keyboard equivalents (shortcut keys) to menu items
Although Mac OS programming knowledge is not required to use MRJToolkit, you should read the "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information on how the Finder handles files.
Chapter Contents
- Including MRJToolkit With Your Application
- Manipulating Files
- File Types and Creators
- The MRJOSType Data Type
- Setting the Default File Type and Creator
- Setting or Reading File Types and Creators for Existing Files
- Finding an Application With a Given Creator
- Finding Special Folders
- Responding to Simple System Events
- Assigning Keyboard Equivalents to Menu Items