Integration Into an Application
To integrate the Quaqua Look and Feel in an application,
you need to do the following:
- Include the file
quaqua.jar
in
the class path.
If you don't need the full functionality of the Quaqua Look and Feel, you
can include one of the following files instead: quaqua-filechooser-only.jar
, quaqua-colorchooser-only.jar
or
the quaqua-menu-only.jar
.
- Include the directory
/System/Library/Java
in
the class path.
In most cases, this happens automatically, if
you include quaqua.jar in the class path, because quaqua.jar manifest
has a Class-Path attribute that points this directory.
/System/Library/Java is needed
to generate application and file icons. If this directory is not
in the class path JOptionPane icons won't display the application
icon and JFileChooser will not display a large preview icon of
the currently selected file.
- Include the files
libquaqua.jnilib
, libquaqua64.jnilib
and libquaqua64.dylib
in
the library path.
In most cases, it is sufficient to put these files in the
same directory as the quaqua.jar file. In some cases you have to specify
the library path explicitly using the system property "java.library.path".
These JNI libraries are needed by the JFileChooser and by JSheet.
If you need either of them, you can omit this step.
- Change the code of the
main
method according the
following code snippet:
public class MyApplication
{
public static void main(String[] args)
{
//
set system properties here that affect Quaqua
// for
example the default layout policy for tabbed
// panes:
System.setProperty(
"Quaqua.tabLayoutPolicy","wrap"
);
//
set the Quaqua Look and Feel in the UIManager
try {
UIManager.setLookAndFeel(
ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel();
);
// set
UI manager properties here that affect Quaqua
...
} catch (Exception
e) {
//
take an appropriate action here
...
}
// insert
your application initialization code here
...
}
}
|
Alternatively, Quaqua can be set in the UIManager using a class name String. This should be avoided, because the class name may change due to incompatible changes in the Java API.
- For J2SE6 and J2SE7 the class name is "ch.randelshofer.quaqua.QuaquaLookAndFeel".
The Quaqua Look and Feel can be customized using System
properties, UIManager properties and Client
properties.