JRootPane (JFrame, JDialog and floating palette windows)

Client properties:

Property

Type Notes

JComponent

.sizeVariant

java.lang.String Values: "regular", "small", "mini"
Quaqua.RootPane
.isPalette
Boolean

Specifies whether the parent JFrame/JDialog of the JRootPane is used as a palette window.
Works only when the JRootPane decorates a JFrame/JDialog.

Quaqua.RootPane
.isVertical
Boolean

Specifies whether the title bar shall be placed vertically or horizontally.
Works only when the JRootPane decorates a JFrame/JDialog.

Window
.alpha

Float

Sets the transparency of the window.

Window
.documentFile

File

Shows the icon of the file in the title bar.

Window

.documentModified

Boolean

Sets the window modified indicator in the title bar.

Window

.shadow

Boolean

Sets the shadow of the window.

Window

.style

java.lang.String Values: "regular", "small"
windowModified
Boolean

Sets the window modified indicator in the title bar (deprecated).

 
UIManager properties:

Property

Type Notes
RootPane
.windowSnapDistance
Integer

Specifies the distance up to which windows snap to the edges of each other and to the edges of the screen. Setting this to a value to 0 or smaller, disables window snapping.

Note: Snapping is only in effect for look and feel decorated windows.

Note: Users can hold down the Alt-Key while moving a window to prevent snapping.

RootPane
.draggableWindowBackground
Boolean

Default value for the client property "apple.awt.draggableWindowBackground". Setting this to true makes all windows, which have a translucent area, draggable by all of their display area. This is only in rare cases desirable, for example, when only display components are on a window.

 

Client property: windowModified

 

Sets whether the document contained in the window has been modified and not saved yet.

You should set this property with an argument of Boolean.TRUE every time the window’s document changes in such a way that it needs to be saved and with an argument of Boolean.FALSE every time it gets saved. Then, before closing the window you can use getClientProperty("windowModified") to determine whether to allow the user a chance to save the document.

 

 

Client properties: Quaqua.RootPane.isPalette and Quaqua.RootPane.isVertical

These properties can be used to realize floating palette windows.

These properties are only in effect, when the JRootPane decorates the JFrame/JDialog.

Setting the property Quaqua.RootPane.isPalette to true makes the title bar of the JFrame/JDialog always draw in the active state.

Setting the property Quaqua.RootPane.isVertical to true places the title bar of the JFrame/JDialog on the left instead of on the top.

Floating palettes work best, when the font size of the JRootPane is set to 11 or to 9. Font size 11 results in a small sized title bar. This is useful if you want to display a title in the title bar. Font size 9 is useful, if no title shall be displayed. Instead of setting the font size, you can set the client property JComponent.sizeVariant.

The following code snippet shows how to use the client properties and the font size:

JDialog d = new JDialog(myFrame);

d.setTitle("Palette Window");
d.setAlwaysOnTop(true);
d.setUndecorated(true);

d.setFocusableWindowState(false);

 

JRootPane rootPane = d.getRootPane();
rootPane.setWindowDecorationStyle(JRootPane.FRAME);
rootPane.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
rootPane().putClientProperty("Quaqua.RootPane.isVertical", Boolean.TRUE);
rootPane().putClientProperty("Quaqua.RootPane.isPalette", Boolean.TRUE);

 

d.setVisible(true);

Note: To create a true floating palette, you are required to implement a handler which hides all floating palettes when no application window is active.