Creating Layouts for Mac OS X
You may want to read the Layout
Examples chapter of the Apple
Human Interface Guidelines (AHIG) before you start creating layouts for
Mac OS X.
When you create layouts based on the AHIG guidelines
using the Quaqua Look and Feel (Quaqua), it
is important,
that
you are
aware
of the following issues:
- Mac OS X controls should always be center-equalized. On most other platforms,
controls are often left justified.
Quaqua does not provide a facility for cross-platform layouts. That is,
Quaqua does not automatically turn a left justified layout into a center-equalized
layout. The task for
creating
center-equalized layouts is yours.
- A Mac OS X control can come in up to three different size styles: full
size, small and mini.
Quaqua supports the full size and the mall size style as a side effect
of the font size. Set the font of a JComponent to Lucida Grande 13 for
full size
style,
and to
Lucida
Grande
11
for the small size style. The mini size style is currently not supported.
- The AHIG describes the spacing around a control
in pixels. The spacing is given for the visually perceived bounds of a
control. These values need to be translated when used for Swing
JComponents, because most Java layout managers need spacing values given
for the
clip
bounds
of a control.
Quaqua adds a margin of 3 pixels around the visually perceived
bounds in
order
to
accomodate
for cast
shadows and
focus rings within the clip bounds of a JComponent.
To translate AHIG spacing values into Quaqua spacing values, subtract 3
pixels for spacings given between a control
and
its
parent
container,
subtract
6 pixels
for
spacing givens between adjacent
controls. Sometimes this may result in negative spacing values, which is
okay, because the margin of Quaqua is translucent.
Please note that only the Quaqua look and feel supports visual margins.
All other look and feels, including the Apple look and feel, don't support
visual margins, i.e. the amount of pixels that needs to be added or subtracted
to the spacings given in the AHIG, is different for each control!
- The preferred spacing around a control depends
on its relationship to other components on a form (related, unrelated,
indented) and also
on the type of the control and on its size style.
Quaqua together with LayoutStyle aware layout managers, such as GroupLayout,
can automatically take into account most of these spacing guidelines.