Synthetica + NetBeans RCP, Part II(19:08, 25. Nov. 2011)
This Article describes how to integrate Synthetica, Themes and SyntheticaAddons in your Netbeans Platform application (RCP). Instead of extending the classpath as described here, let's create two additional modules and add these modules to our NetBeans RCP application.
The first module covers Swing core components only. For this we create a module called Synthetica which provides Synthetica's core library and all needed theme libraries. We additionally create a LAFInstall class to install the look and feel on application startup. The "--laf" parameter, mentioned in the first article, is therefore no longer needed.
Create Module Synthetica
Create a new module
Name: Synthetica
Code Name Base: myrcp.synthetica
Finish
Select Module Synthetica / Properties
Select Libraries / Module Dependencies
Add Dependency: Module System API, Utilities API
Select 'Wrapped JARs'
Add JAR: core library synthetica.jar and your preferred theme e.g syntheticaSimple2D.jar, Note: the Standard theme is already part of synthetica.jar
Select API Versioning, select modul type eager and make myrcp.synthetica and all listed packages public
Create class myrcp.synthetica.LAFInstall and override the method #restored()
public class LAFInstall extends ModuleInstall
{
@Override
public void restored()
{
try
{
UIManager.setLookAndFeel(
"de.javasoft.plaf.synthetica.SyntheticaSimple2DLookAndFeel");
}
catch (Exception e)
{
Exceptions.printStackTrace(e);
}
}
}
The second module is used to provide all SynteticaAddons libraries and covers UI-support for Netbeans components. In this example configuration we assume that SyntheticaSimple2D is used as preferred theme, which also means that the theme extension syntheticaSimple2DAddon.jar has to be added to your module.
Create Module SyntheticaAddons
Create a new Module
Name: SyntheticaAddons
Code Name Base: myrcp.syntheticaaddons
Finish
Select Module SyntheticaAddons / Properties
Select Libraries / Module Dependencies
Add Dependency: Look & Feel Customization Library, Nodes API, Synthetica, Tab Control, UI Utilities API, Window System API
Selet API Versioning, select modul type eager and make all packages public
Update: In case you have to use SwingX or SyntheticaAddons components it's better to use one single module to avoid classloader issues. So simply add the settings described for the SyntheticaAddons module to your Synthetica module and remove all dependencies to the SyntheticaAddons module from your RCP project.
Modify your Main/Core Module
Select your Main/Core Module / Properties
Select Libraries / Module Dependencies
Add Dependency: Synthetica, SyntheticaNetbeans
Modify your Netbeans Platform Application
Select Important Files / Project Properties
add app.conf=myrcp.conf
create new file myrcp.conf to provide basic configuration
# ${HOME} will be replaced by user home directory according to platform
default_userdir="${HOME}/.${APPNAME}/dev"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/dev"
# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding testrcp -J-Dnb.forceui=de.javasoft.synthetica.netbeans.SyntheticaLFCustoms -J-Xms24m -J-Xmx64m"
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea
make sure that -J-Dnb.forceui=de.javasoft.synthetica.netbeans.SyntheticaLFCustoms has been added to the default options of the config file