A Sheet is a document modal dialog that is displayed below the title bar of its owner window. JSheet roughly implements the look and feel of a Mac OS X Cocoa NSSheet component.

Quaqua Look and Feel - JSheet with a JOptionPane

JSheet provides static convenience methods for displaying JOptionPane's and JFileChooser's.

Since JSheet is only document modal, its show method does not block while the sheet is visible. You have to implement a SheetListener to get the return value of the JSheet.

Displaying a JOptionPane as a sheet

Here is how to display the option pane shown at the top of this page. Note the use of a client property for specifying the destructive choice on the sheet, and the use of the SheetListener:

JOptionPane pane = new JOptionPane(
    "<b>Do you want to save changes to this document<br>"+
    "before closing?</b><p>"+
    "If you don't save, your changes will be lost.",
Object[] options = { "Save", "Cancel", "Don't Save" };
    "Quaqua.OptionPane.destructiveOption", new Integer(2)
JSheet.showSheet(pane, frame, new SheetListener() {
    public void optionSelected(SheetEvent evt) {

        Object value = evt.getValue();
        if (value == null || value.equals("Cancel")) {
        } else if (value.equals("Don't Save")) {
        } else if (value.equals("Save")) {

Displaying a JFileChooser as a sheet

Quaqua Look and Feel - JSheet with a JFileChooserThe following code snippet demonstrates how to display a file chooser using JSheet. Please notice the use of the SheetListener:

final JFileChooser fileChooser = new JFileChooser();
JSheet.showSaveSheet(fileChooser, frame, new SheetListener() {
    public void optionSelected(final SheetEvent evt) {

        if (evt.getOption() == JFileChooser.APPROVE_OPTION) {
            File file =