Make Mac Applications Behave Normally #81
Chapter 11, Native Integration and Packaging
Showing the Mac Grow Box
Traditionally, Mac applications have reserved the bottom-right corner as the
only space that you can drag to resize a window. It is shown as a diagonally
dimpled grow box, often reserving the space above it for a scrollbar. There’s
also sometimes either a scrollbar or a status bar to the box’s left. At any rate,
this approach to resizing is very different from having a few pixels for a bor-
der on the right, left, and bottom edges—all of which are draggable—as
users expect from Microsoft Windows.
By default, the grow box is not shown in Mac Java windows. You can make
the grow box appear by setting the property
apple.awt.showGrowBox to true.
This does, however, have a significant downside, as seen in Figure 11-5.
The grow box intrudes into the Java display space. In this case, it clobbers
the right-most part of a
The proper way to handle this is to reserve some space for the grow box.
The simple thing to do—in fact, it’s what Apple’s Java 1.3.1 did by
default—is to reserve 15 pixels of vertical space for the grow box. You could
probably just have a subclass of
JFrame for your Mac users that puts the
usual frame contents in the
CENTER of a BorderLayout, and creates a spacer
Box.createVerticalStrut(15) to reserve space for the grow box in the
SOUTH. Figure 11-6 shows the corrected window after this approach is
Figure 11-4. A custom application name for a Java application
Figure 11-5. Mac grow box intruding on Swing display space