Porting a Swing Application to the NetBeans Platform

kaputmaltwormSoftware and s/w Development

Aug 15, 2012 (5 years and 7 days ago)

301 views



Porting a Swing
Application to the
NetBeans Platform
Anton Epple
www.eppleton.de/blog
Our Starting Point

Swing applications on homegrown
framework:
>
Weblauncher
>
XML based configuration
>
Update Manager
>
Download Manager
>
Proxy Handling
>
Options/Settings
>
JavaHelp
>
Docking
>
WebBrowser Component

Lots of work to maintain it
Why use Rich Client Platform?

Less framework maintenance

Generic features for free (Update
Manager, docking...)

Less boilerplate code

Standardized L&F (Dialogs & Wizards,
Options Panels)

Modular structure (easy Dependency
Management, Versioning)
Alternatives to NetBeans Platform
Swing Application Framework (JSR
296)
Basic Functionality, but no modules
In Hibernation?
Eclipse RCP
Stable and well documented
Features comparable to NB
Platform
Spring Rich Client Platform (since
2006)
Relatively new
Somehow unsure future
Why NetBeans RCP and not Eclipse?

NetBeans when creating Swing
Applications

Eclipse when using SWT
Examples of ported Applications
Sepix Sales System
http://www.sepix.de/
Examples of ported Applications
InstantJChem
Sketsa SVG Graphics Editor
Sketsa
http://www.kiyut.com/products/sketsa/
ChipInspector
Anwendungsbeispiele
ChipInspector
http://www.genomatix.de
Examples of ported Applications
http://bluemarine.tidalwave.it
http://bluemarine.tidalwave.it
Demo
Ask us about these Applications
1.
Sepix CRM (Aljoscha Rittner )
2.
Instant JChem (Tim Dudgeon)
3.
Sketsa (Tonny Kohar)
4.
ChipInspector (Me)
5.
Blue Marine (Fabrizio Giudicci)
Demo

Porting a simple Swing application to
the NetBeans Platform
The Porting Process
1.
Third-party Libraries -> Library
wrapper
2.
Swing Panel -> TopComponent
3.
Action -> CallableSystemAction,
CallbackSystemAction...
4.
Adjust Menus -> Layer
(SystemFileSystem)
5.
Dialogs, Wizards -> Dialogs API
6.
Beans -> Node Wrappers
7.
Synchronizing Views / Selection ->
Lookup
8.

...
ChipInspector
Anwendungsbeispiele
ChipInspector
http://www.genomatix.de
Extras that made life easier

You can exclude stuff from standard
Java (Example JAX-WS) -> More
control over environment

You can use ServiceLoader like
functionality in java < 1.6

SystemFileSystem for storing your
data

You can easily create distributions
(Zip Distro, Webstart, OpenInstaller,
Os X Application)
Lessons learned

Took about 6 months to port (Lots of
refactoring involved)

First steps are simple,

then there's a steep learning curve.

NetBeans really helped reducing
boilerplate code

The real gain from porting comes
from adapting NetBeans architecture
Resources
Tutorial for getting started:
http://platform.netbeans.org/tutorials/60/nbm-porting-basic.html
Blue Marine developer's experience:
http://netbeans.dzone.com/news/from-pain-gain-swing-and-netbe
Interview with Sepix Sales-System Developer:
http://netbeans.dzone.com/news/interview-porting-a-crm-applic
XING Group
http://www.xing.com/group-20148.82db20
Questions & Answers