Griffon+Remote GORM+X: Inspirations for the Best RIA Horse!

Today I explain a possibility of a pure Java-based client/server application (the client side should be a Rich Internet Application) with a database backend.

I know that other people might already had this idea and others implemented this in a different way and Griffon is on the way, but let my explain it now in (more) detail. It is only an aggregation of existing tools.

How should it look like?

We simply replace the HTML-view of an ordinary Grails application with Griffon! So instead of a browser we will have the mature JVM and we could programm all in Java/Groovy! No JavaScript, no HTML, no CSS, no …!

(Ups. No CSS? Okay we could use css on the desktop, too)

Shouldn’t this be an easy task to replace the V in an MVC application? The problem lays in the detail. E.g. do we need the full GORM functionality on the client side (‘remote GORM’)?

The cayenne framework (a nice hibernate alternative) supports the so called remote object persistence which would be great for this kind of application. They use the hessian library to communicate over HTTP from the client ‘over’ the server to the database. So, the db-programming-style on the client is nearly identical to that on the server!

So, do we need Person.findByXY and all the other, useful methods on the client? I fear tweaking hibernate is necessary but maybe with some grooviness we could avoid this!?

Another simpler approach would be to use the already available services of Grails for the client side. With Xml (Un-)Marshalling or SOAP like it was done before? But hmmh, I prefer the cayenne way … its groovier!

So, what do we need for our 3 tier pure Groovy solution?

We’ll need Grails!

To be a bit more specific: we would actually only need the GORM plugin (and Spring) from the Grails project for the server to communicate to the DB and manage the migrations.

We’ll need Griffon!

We need the full Griffon stack for the client. And if we only use GORM from Grails we will use Griffon also on the server side, I guess.

So either GORM+Griffon+Griffon (db+server+client), which would be more consistent

or GORM+Grails+Griffon which could be easier to implement at the moment.

We’ll need Spring Rich Client!

We need some nice to have packages from the Spring Rich Client project for the client side: validation, window-docking, master-details stuff, …

We’ll need the Hessian Library!

Additionally to the GORM plugin we will need the Hessian library to easily (!) communicate between the client and server. (Short explanation: Hessian library is RMI without drawbacks.) Later on we could implement a remote GORM with the help of this library (see above)! Without this functionality we won’t have fun: either we can only implement a two tier applications (client+db) or the programming is as slow as it would be with an ordinary non-groovy desktop application (via SOAP etc).

We’ll need JavaFX!

Why do we need JavaFX if we already have Groovy as the UI DSL? Marketing! That would mean a broader audience and maybe some tiny  support of Sun 😉

Another feature of JavaFX would be that designers could create good looking SwingUIs for us without knowing Java/Groovy.

XML Marshalling


TimeFinder v4 Released – Automatic Educational Scheduling

Today the TimeFinder Team (its me ;-))
announces the availability of TimeFinder v4!

TimeFinder allows universities and schools to reduce and even avoid conflicts in the timetable! TimeFinder will improve the work of the human timetabler at the institute. A lot of work which would be done by hand to create the educational schedule could be done with TimeFinder.

TimeFinder is completely free and independent of the operating system (via Java 6). The power of TimeFinder is its algorithm. It eliminates the hard-conflicts of nearly all datasets of the International Timetabling Competition 08 in under 20 seconds on a normal laptop. And it can be applied on real data like the one from University of Bayreuth.

Pictures tells a lot more than 1000 words, so here is a video as introduction

and here are some screenshots:

The first screenshot is how editing of events works

  1. create a new event
  2. then set the name
  3. and specify the start and duration
  4. after this you can add some visitors under Event Table->Persons


And here you see how TimeFinder optimized an instance of the International Timetabling Competition 08:


See some more screenshots and look again here for the video documentation.

Start TimeFinder right now via WebStart! Or download the jar which is faster!

New Features

The TimeFinder Team worked hard to add the following features in this version for you:

  1. Events with any duration are now possible – without performance losings! (before only duration=1 was possible)
  2. A more robust and lightweight Swing component the TimeFinderPlanner to display the schedule/timetable of all locations and persons was implemented and replaces the JavaFX component hassle. This component is small (<30KB) and but has some dependencies (1MB). It has the same purpose as MigCalendar, but is of course not as powerful as this.
  3. Import of text files (tab separated, comma separated data). XML was already supported in previous versions
  4. Auto-import for the last imported file
  5. Cloning entities is now possible
  6. Anonymize data, so that institutes could give away its data for performance-tests and other research projects.
  7. Import of the data for University of Bayreuth (Germany) and the possibility to optimize this data set with >1500 events; >100 locations; >600 resources (persons/course of studies) is now possible and shows how other institutes could use its existing data with TimeFinder.
  8. Removed a lot of deprecated classes and removed unused dependencies (now ~11MB)
  9. Now the English TimeFinder is fully translated into German too. Translation is now simplified with a small tool.
  10. A new maven module called algo was created (~3MB), to reduce coupling of the algorithm to the GUI. Now it is theoretically possible to deploy the algorithm without the spring dependency e.g. to an optimization server.


No software is complete or bug-free, and so is TimeFinder which is beta software at the moment. You are free to support TimeFinder with your constructive critique, blog posts or even money if you like to make it better. Feel free to contact me or raise an issue if you find a bug.

Check the documentation or watch an introductive video to get an overview. Keep in mind that updating documentation is still work in progress.

You can win

If you know some Java and like coding GUIs, databases or algorithms you can contact me and win experiences via joining the project!

Especially the calendar component TimeFinderPlanner could be alluring for people with Java2d experiences or interests in this area.


This application wouldn’t be the same without the following nice open source projects:

… and last but not least thanks to NetBeans – the only IDE you need
and Yourkit profiler, which offers open source projects a free license!

TimeFinder – Powerful Optimization Algorithm, RIA and more

TimeFinder is an Open Source Timetable Optimizer for universities and schools, which uses the Spring Rich Client project to create an easy to use application with a nice user interface, a database and … more bla bla …

ok, it is a bit dingy headline and a more dingy introduction, but I would like to invite you to test the latest development version v4 of TimeFinder now! And without such a headline you woudn’t have read this. And I feel that I would like to release TimeFinder in the next weeks, so I need some beta testers. Go here to see some screenshots.

Get the dev version of TimeFinder here, double click the jar (optionally read the documentation for v1) and tell me:

  1. If you understand the purpose of TimeFinder from the website
  2. If you understand the user interface and how you can insert data
  3. If you find a bug
  4. If you need other features

Any feedback is welcome! Please contact me at peathal AT yahoo |dot| de, post an email to the mailing list or simply leave a comment here.

Java Application Frameworks (not only client side …)

In an old post I listed all Java libraries,where only two application frameworks were listed.

Today it is time to list some client side Java application frameworks, because I discovered some new ones while reading the W-JAX announcement. Some of the listed frameworks will make developing application with DB easier. And some of them are real 3 tier architectured frameworks. Some of them even allow you to develop RIA’s and web frameworks at the same time.

Here is now the list of open source Java application frameworks especially for the desktop. Feel free to add some more (via comment):

  1. NetBeans RC Platform, my IDE is build on this 😉
  2. Eclipse RC Platform, has an interesting ‘subproject’ called Riena
  3. Spring RC, at the moment my favourite used in TimeFinder
  4. AppFramework which won’t be in JDK 7, but has a lot of derivatives
    1. Swing application framework fork
    2. Guice Utilities & Tools Set
    3. Better Swing AppFramework
    4. with OSGi
  5. JVx, looks very nice! Makes fast development of Swing applications possible (with db support)
  6. OpenXDev a framework which could be used as a base for your next Swing project
  7. Genuine is a client framework for Java Swing applications for which it provides basic infrastructure
  8. Genesis with Swing and SWT binding; Easy, transparent remoting; etc
  9. GWT (although only intented for javascript widgets it could theoretically being used as a rich client running in the jvm)
  10. OpenSwing Framework is an open-source suite of advanced graphics components based on Swing toolkit
  11. Leonardi Framework
  12. Jspresso is a framework for building rich internet applications
  13. Viewa framework
  14. XUI is a Java and XML RIA platform
  15. Swing + XUL = SwiXAT looks interesting but dead, the same for the next:
  16. Swing + XML = SwiXml a small GUI generating engine.
  17. buoy built on top of Swing. Xml serialization of UI possible
  18. But why xml if you have groovy: Griffon 😉
    Now, a nice approach would be to send/receive groovy code and build the clients’ GUI on fly… this would be like replacing the browser+html+javascript system with rock solid JVM+Groovy 😉
    Another Comment from AndresAn addtional tidbit about Griffon, it can be seen as a polyglot programming desktop/RIA framework as it supports 5 JVM languages at the moment: Java, Groovy, Scala, Clojure and JavaFX. It also lets you embed JavaFX components on Swing containers.
  19. JMatter is a software framework for constructing workgroup business applications based on the Naked Objects Architectural Pattern.
  20. Metawidget is a ‘User Interface widget’ that populates itself, at runtime, with UI components to match the properties of your business objects.
  21. Pivot a platform for building rich internet applications in Java

Especially JVx with a webstart demo looks very promising! It even feels better and faster than an ordinary flash application!


  1. Aviantes-Business-Application-Framework
  2. Jide Desktop Application Framework
  3. Jazz

I listed only frameworks which help developers to easier build client side desktop application and only if they run in the JVM. So frameworks where the client is browser-based (aka web frameworks) are not listed here.

For a good list of J2EE frameworks go to or to wikipedia. (Or here, or there, or even here)

Update: For additional comments look at dzone

Plugable Spring RC? (OSGi with Spring Rich Client)

My last post was about pure Swing, which could be easily OSGified. OSGi technologie can be e.g. used to hotdeploy or undeploy jar files to your application server (at the moment only Spring’s server is suggested) or simply to update your Swing application at runtime or write plugins for them. I don’t know for sure, but it seems to me that Eclipse is the most prominent user of OSGi (equinox is one implementation of the specification…) as desktop application, although NetBeans can now use OSGi bundles.

(BTW: do you know a funny myth where the small “i” from OSGi could come from? No? Read the comments here!)

In the last post I show you several swing applications, which were successfully OSGified, today I would like to list Swing- or Eclipse-based applications which use Spring Dynamic Modules:

Then today, in contrast to my last post, I would like to show you an identical solution for the Spring Rich Client project.

Why should I use another framework on the top of OSGi? This is simple: Spring DM provides several nice features, like no dependency on the OSGi implementation (felix, equinox, knopflerfish) and even no one on OSGi at all. Everything (and think) is a bean, like always! But why Spring DM? Why not Declarative Services from OSGi itself or Apache iPOJO? This is simple: I don’t know the others and Spring Rich Client cries for the Spring solution 😉

But to make this short story very short: after struggling the last two days to get Spring Dynamic Modules integrated with Spring Rich Client I gave it up and tried the pure OSGi solution – and – it works. It might be an ugly solution for all those of you who like dependency injection, but this can be optimized later. Today this might be the first plugin for Spring Rich Client – ever:


The button “say hello” with its JOptionPane message was installed through the dynamically loaded plugin. The source code is nearly identical to the one in my previous post. Just add the Spring RC startup before you grab the menu from the application to create a MenuTracker, which calls the MenuService(=plugin):

public void start(BundleContext context) throws Exception {
 menuTracker = new MenuTracker(context, Application.instance().getActiveWindow().getControl().getJMenuBar().getMenu(1));;

The source is available from my TimeFinder project via:

svn checkout -r 595 timefinder

Be sure to start the application from de.timefinder.core.osgi.Activator (main method!).

I hope this post inspired someone to be the first one with Spring DM + Spring RC marriage … or sb. suggests working examples how Spring DM could be started from command line or from NetBeans.

Swing Talks (video and slides available)

Maybe you already know that at parleys they put some nice presentations.

Especially the talk Spring is Swinging from Jo Wyns was impressive to me, where he talks about the Spring Rich Client project.

The presentation seems to be an old one (where is the date??), but it is even today a hot theme: rich desktop applications with database access (or internet connection). He concludes his talk with a tip, when to stop or when is is a bit too far. I think with too far he means projects like the metaframeworks I talked about earlier. And maybe this is true: in commercial applications nearly always you will need to customize views etc. then the simple “annotated domain object”-approach will only work for the first rapid prototype.

Have fun with this talk and with the related talks (here or here).

A Pagination-enabled List in Swing with Hessian

In an ealier post I documented how to set up a maven project to use port 80 for client-server-communication in a Java Swing project.

Today I want to show how you could implement a list which shows ‘all’ objects of one entity. It is common that there exists thousand or more objects for one entity in a database, so pagination is required. I know that JList and JTable could handle very large result sets easily, but the bandwith would be the limitating factor and loading all the objects into memory is often not required (and not good …).

I will use the simplest Swing solution with some pagination buttons, although it would be a lot nicer to have the pagination with a custom vertical JScrollBar-implementation which loads the objects while scrolling (‘on demand’). But this will be either a task for my readers or for myself at a later time. First we can take a look at the resulting (primitive) GUI:


The interface for the data access object was quickly created:

public interface RemoteDao<T> {
   List<T> getAll(int index, int items, String query);
   int count(String query);

… the implementation, too (but for this see the source in the provided project). You can simply replace the existing fake-implementation with a RemoteHibernateDao or sth. like this, if you like.

The communication follows this picture:


To try this maven project: start PaginationServlet under the paginationlist package and then the PaginationClient. The Swing gui should pop up and you could hit enter after a search string like ‘person’ or ’18’ in the textfield at the top. Now try to paginate through the results with the provided buttons at the bottom.

The final goal for me (at a later time) will be to replace the left ‘Available’-JList in a ShuttleList (from Spring rich client project) with my PaginationList. For you information: with a normal ShuttleList one could drop one or more items from ‘available’ list to ‘choosen’ with the buttons in the middle (they have nothing to do with pagination!). Here a normal shuttle list is shown:


So, now have fun with my small Swing example and feel free to provide feedback or ask questions if you need help while maven or sth. else!

Spring Rich Client Links

Once again a link collection – this time about the great Spring Rich Client Project. Which is a nearly complete platform to develop your next feature-rich Java client application.

Spring Rich Client – Part 2

Let us do some more basics with the “Spring Rich Client” 1.0.0 (SpringRC). Although it is time to give an overview of the entire architecture I won’t do this here, because I am a newbie with Spring and SpringRC. So we will just look into the steps how we get things running.

Update: See an older post for a good intro or this link collection for more information.


First of all we want to include a license prompt on the very first startup. If it is in pure text format surround the license with <pre>licenseText</pre>, save it to the classpath as /path/license.txt and do the following:

  • Add the source code into LifecycleAdvisor
        private final Log logger = LogFactory.getLog(getClass());
        private static final String SHOW_WIZARD_KEY = "";
        private Settings settings;
        public void onPreStartup() {
            boolean showDialog = true;
            if (settings.contains(SHOW_WIZARD_KEY)) {
                showDialog = settings.getBoolean(SHOW_WIZARD_KEY);
            if (showDialog && getApplication().getApplicationContext().containsBean("setupWizard")) {
                SetupWizard setupWizard = (SetupWizard) getApplication().getApplicationContext().getBean(
                        "setupWizard", SetupWizard.class);
                settings.setBoolean(SHOW_WIZARD_KEY, false);
                try {
                } catch (IOException ex) {
                    logger.error("Can't save state.", ex);
                }    }    }
        public void setSettings(Settings set) {
            settings = set;
  • Add the following text into the application-context.xml
    <bean id="setupWizard" class="org.springframework.richclient.application.setup.SetupWizard">
        <property name="licenseTextLocation" value="/path/license.txt" />
    <bean id="xmlInternalSettings"
    <bean id="settingsManager" class="org.springframework.richclient.settings.SettingsManager">
            <property name="settingsFactory">
                <bean class="org.springframework.richclient.settings.xml.XmlSettingsFactory"/>

    And insert <property name=”settings” ref=”xmlInternalSettings” /> into the lifecycleAdvisor bean’s property list.

  • As last step you have to fill in the message text for this wizard into the file:
    setup.intro.welcomeTo = Welcome to
    setup.intro.title = TimeFinder!
    setup.intro.description = TimeFinder in one of its future releases will help you with automatic and manual timetabling.
    setup.cancel.title=Cancel Setup
    setup.cancel.message = Do you really want to exit the application?
    acceptLicenseCommand.label=I &accept the terms of this license agreement
    doNotAcceptLicenseCommand.label=I do ¬ accept the terms of this license agreement
    setup.license.title=License agreement
    setup.license.description=Please read the following license agreement carefully

The most of the xml code above is necessary to inject a new instance of Settings which will be created from the SettingsManager.

… Break …

Does anybody of you know, how I can do this in Java, not in ugly xml? Well, I could create the factory directly in the LifecycleAdvisor, but how can I do this dependency injection in Java (with Spring)?

… Okay, let us go further …

This settings object is then accessible within the LifecycleAdvisor because of the setSettings method and is necessary to save, if this wizard should be prompted on the next startup again. The xml-settings will be written to currentPath/settings/internal.settings.xml.
The used SetupWizard extends from AbstractWizard. This abstract class could be used for any other wizards: just add one or more AbstractWizardPages to the wizard and see this documentation. Here is the result:

Another cool feature is to show a progressbar on the splashscreen. This was very easy: add (or replace the existing) bean to the startup-context.xml file:

<bean id="splashScreen" class="org.springframework.richclient.application.splash.ProgressSplashScreen" scope="prototype">
        <property name="imageResourcePath" value="/de/peterk/springr/ui/images/splash-screen.png" />
        <property name="showProgressLabel" value="true" />

Now I did an ugly hack. I want to change the colors of the progressbar. But only on the progressbar on startup, so we have to revert the following code:

Color myYellow = new Color(255, 225, 100);
Color myGreen = new Color(120, 208, 60);
UIManager.put("ProgressBar.selectionForeground", myYellow);
UIManager.put("ProgressBar.selectionBackground", myGreen);
UIManager.put("ProgressBar.foreground", myGreen);
UIManager.put("ProgressBar.background", myYellow);
UIManager.put("ProgressBar.border", new LineBorderUIResource(myYellow));

To revert these changes, please look into the method LifecycleAdvisor.onPreWindowOpen (see the resources section, I will not post it here – it is too stupid ;-))

Here is the result:

Views …

Hopefully I can create a next blog entry about the docking framework MyDoggy and the integration into SpringRC. Now it works like a charm – try it out! (see resources).

Today I will show what you can apply to all ‘component managers’ that are integrated in SpringRC.

First: there is one application per virtual machine. But there could be one or more ApplicationPages (JFrames) with several views (center, north, south, …). In our case (MyDoggy) there is only one ApplicationPage.

Normally you want to have more than one component per start-up page. To change this add the following xml to the application-context.xml:

<bean id="aLotOfViews" class="">
   <property name="viewDescriptors">

And change the startingPageId in the lifecycleAdvisor bean to aLotOfViews. With the upcoming MyDoggy 1.5.0 enabled we can get this nice layout, which will be automatically saved(!):

Of course it is possible to use other layout manager like swing dockings:

… and more!

If you want to use custom components: just add them! I created a custom component with the open source Matisse GUI builder integrated in NetBeans. Here is the code how you can put this component into SpringRC:

public class CalculatorView extends AbstractView {
    protected JComponent createControl() {
        JPanel panel = getComponentFactory().createPanel(new BorderLayout());
        panel.add(new CalculatorPanel()/*created with Matisse*/, BorderLayout.CENTER);
        return panel;

To add this view to the startingPage do (aLofOfViews already references to this bean, so no changes are necessary there):

<bean id="view2" class="de.timefinder.core.ui.mydoggy.MyDoggyViewDescriptor">
        <property name="viewClass" value="de.timefinder.core.ui.CalculatorView" />

One thing you have to know is: How to translate keys within this ‘external’ CalculatorView?

In Matisse do:

  1. Click the button, where you want to translate the text
  2. Then – in the property panel on the right side – click on the […] button
  3. Select “Resource Bundle” instead of “Plain Text”
  4. Use the file for the bundle name
  5. Insert the appropriate key (defined in
  6. Use the following line to get the value (click on the “Format…” button) Application.instance().getApplicationContext().getMessage(“{key}”, null, null)

For all of the following components it is easier: do 1, 2, 3 and insert the key! This could be the new slogan for Matisse 😉

Now some more I18N. For example you want to display: “Result of $number!” you should use the following line in

calculatorPanel.title=Result of {0} !

and get the formatted string via

Application.instance().getApplicationContext().getMessage("calculatorPanel.title", new Object[]{result}, null);

Another small point could be the ugly output of the standard java 1.4 Logger. We will now change the two-lined logging output into a one-lined. Actually this is a one-liner if you look for yourself into the resource section for the TFFormatter class:

java.util.logging.Logger.getLogger("de.timefinder").getParent().getHandlers()[0].setFormatter(new TFFormatter());


In Swing you can use the Swing ProgressMonitor, but in SpringRC you should use the integrated ProgressMonitor to indicate the current progress of a task in the bottom right corner of the page:

With the factorial view of my example you can calculate, yes, factorials. I tried “50 000” and the calculation took nearly the same time as adding the number to the JTextArea …

So, use the ProgressMonitor in combination with the SwingWorker (I grabbed it from jdesktop, but you can use SpringRC’s Swingworker as well. Get the concurrent package from here or through maven. )

Now you can use the following code to execute a long running task:

ApplicationWindow aw = Application.instance().getActiveWindow();
final ProgressMonitor pm = aw.getStatusBar().getProgressMonitor();
String str = Application.instance().getApplicationContext().getMessage("calculatorPanel.startTask", null, null);
pm.taskStarted(str, -1);
SwingWorker sw = new SwingWorker() {
        BigInteger resultLong = BigInteger.ONE;
        //protected Object construct() in SpringRC's SwingWorker!
        protected Object doInBackground() {
            // now my long task and the progress indication
            for (int i = 2; i <= fac && !pm.isCanceled(); i++) {
                pm.worked(100 * i / fac);
                resultLong = resultLong.multiply(BigInteger.valueOf(i));
            return resultLong;
        //protected void finished()
        protected void done() {
            // all of the following code will be called on the Event Dispatching Thread
            if (pm.isCanceled()) {
            } else {
    //sw.clear(); // reuse would be possible with SpringRC's SwingWorker!


SpringRC offers us – as client-side-programmers – a bunch of powerful utilities to build our application fast and scaleable. Some parts are well documented; some parts not. But I think with relaunching the project in October ’08 (hopefully!) as Spring Desktop it will get a lot of support from even more users and maybe from the company SpringSource itself. Hopefully then the documentation will be better…

The most important point for me is that SpringRC is ‘only’ a sweat jar collection and not a layer between me and Swing.

Another point is that SpringRC uses dependency injection and NetBeans RCP uses the service locator approach e.g.
SomeInterfaceImpl impl = Lookup.lookup(SomeInterface.class).
instead of the setter injection in the very first example for SpringRC.
For others this could be one more argument against NetBeans RCP (not for me …)


  • Another older, but very good tutorial is located here.
  • Maybe it is interesting to know: in the updated version of the book Spring – A Developer’s Notebook the last chapter 9 is about the Spring Rich Client Project (author was Keith Donald).
  • Here you can find part 1.
  • Here you can download the project without the jars included in the SpringRC’s download (It is a NetBeans 6.1 project, so you can simply copy all jars of SpringRC into the lib folder and open the project with NetBeans. Then resolve references via right click or change the references directly; in nbproject/
  • Update: Other resources can be found here.

Spring Rich Client – Part 1

Today I will start a series about the great Swing framework called Spring Rich Client (SRC). The 1.0.0 version was released in March 2008 and it is not inactive as I thought before.

You can get more information about SRC from:

Why I listed the forum as the first point? Because for a beginner like me it was the best source of information (after the samples).

So, let us set up a hello world example.

  • Download the Spring Rich Client 1.0.0 from here (19 MB, Apache License 2.0).
  • Download my Hello World skeleton (a NetBeans 6.1 project, 60 KB) or use the spring-richclient-archetype from the download bundle of SRC, where you have to install maven before you can compile and run it.

If you use my Hello World skeleton you should open it in NetBeans, right click on the project node and resolve reference problems. Then go to the place where you have unzipped the SRC and add the first jar file. The other jar files should be added automagically for you.

The project with dependencies would be about 2.7 MB, it is not a small overhead, but okay, I think. As an example for the reader one can compare it to the minimal size of the NetBeans or Eclipse RCP.

Now it is time to start the project with F6 or Run->’Run Main Project’. You should see the frog-splashscreen and the final view:

Now let me explain several things that one could customize in SRC. Please see the Resources section for the result of customization.

As the first point I wanted to know how easy it is to introduce docking capabilities (vl docking). It was really easy!

  • add spring-richclient-docking.jar and vldocking.jar
  • and change 2 things in the richclient-application-context.xml file:
  • change class of initialView to org.springframework.richclient.application.docking.vldocking.VLDockingViewDescriptor
  • add a applicationPageFactory to the richclient-application-context.xml

Then you can add a new window to see the results of dragging:

  • Create the class View2
  • add the following to the richclient-application-context.xml:
  • <bean id=”view2″
    <property name=”viewClass” value=”de.peterk.springr.View2″ />
    <property name=”autoHideEnabled” value=”true” />
    <property name=”closeEnabled” value=”true”/>
  • and you are done! Just start the application go to Windows->Show View->View2


how easy is it to use your own layout? Configuring the look and feel:

  • Remove the lookAndFeelConfigurer and add instead:
    <bean id=”lookAndFeelConfigurer” class=”de.peterk.springr.ui.KunststoffConfigurer”></bean>
  • remove looks.jar: 350 kb
  • add kunststoff: 17 kb
  • add the KunststoffConfigurer class to the source package

Okay, then changing the splash screen is trivial: just overwrite the splash-screen.png or change the path in the richclient-startup-context.xml file.

Now we should adjust the size of the view, this can be done with 2 lines in the method SimpleLifecycleAdvisor.onPreWindowOpen:

Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
configurer.setInitialSize(new Dimension(rect.width, rect.height));

And to translate the messages simply copy all property files to e.g. and translate them! In our case it means “cp”. If you want to add a translateable tool tip of the initalView-label just use:

  • lblMessage.setToolTipText(getMessage(“initialView.toolTip”));
  • in InitialView.createControl and add the property initialView.toolTip to the property file.

To set a keyboard shortcuts e.g. to leave the application. You need to add one line to the file

  • exitCommand.label=Exit@ctrl Q

Another interesting action (in SRC they will be called commands) could be restart. So how can we add the action into the menu? You have to add

  • restartCommand.label=Restart@ctrl R
  • in the file and use
  • Application.instance().start(); Application.instance().getActiveWindow().close();
  • within your RestartCommand class. Then add
  • <bean class=”de.peterk.springr.RestartCommand” />
  • into the commands-context.xml (e.g. after <value>propertiesCommand</value> in fileMenu)

The final result is:


Here you can download the extended “hello more” sample (a NetBeans 6.1 project about 90 KB, without dep). The full project was 2.9 MB.


One can say that Spring Rich Client is a powerful jar collection :-). But I would say SRC is a great way for your next swing application!

It is very intuitive to use: the whole sample (including to write this blog) took me only about 6 hours. I think you could be really productive with it! In the case I published the documents with mistakes: please leave your comment here!