Version: 1.2

Posted: 2006-07-11

Build Requirements: Xcode 2.0 or later

Runtime Requirements: Mac OS X 10.4 or later, Java 1.4.2 or later

View Source Code:

Download Sample (“”, 115.2K)
Download Sample (“JSheets.dmg”, 171.4K)


This sample demonstrates a mechanism for displaying document-modal sheets, a feature specific to Mac OS X applications, inside a Java application. It uses the AWT Native Interface (JAWT) to obtain a JFrame's underlying NSWindow (Cocoa) peer, and displays an NSOpenPanel or NSSavePanel using the beginSheetForDirectory:... method. Note the combination of performSelectorOnMainThread and EventQueue.invokeLater to prevent threading problems when communicating between AppKit and AWT.

Document Revision History

Date Notes
2006-07-11Updated compiler options to generate 1.4 compatible bytecode.
2005-08-10Updated Xcode 2.1 project w/ universal binary
2005-06-01Uses AWT Native Interface (JAWT) to Display Cocoa sheet dialogs in Java

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.