Spring Swing Integration

Spring works great with beans created outside the application context.

What is the best way to allow me to create my forms using JFormDesigner, but then use Spring to control component actions?

There are several ways to integrate Spring and Swing (for example, https://www.ibm.com/developerworks/java/tutorials/j-springswing/ ), but this approach assumes that you must extend each one you want to use, an approach that It looks like it will add quite a lot of extra overhead. Also, this approach does not allow me to use JFormDesigner to simulate the appearance of my form.

I also looked at the Spring Rich Client Project , but it doesn’t seem like it has migrated to Spring 3, although this is likely to resume development soon as they moved the project to Github.

+4
source share
1 answer

I have an application that uses the Swing, JFormDesigner, Spring, and Spring RCP built-in panels. There is a view class that extends RCP AbstractView , for each view that has links to the panel (as we call it) and actions, so it can control them. Each view has one main panel (which can be built using JFormDesigner), which is a link to the view. I don't know if this is the best, but it works well.

The main problem I ran into is that defining simple listeners that have a link to the panel requires too much configuration if you want to make them Spring beans. And if you do not, you must manually pass the link to all the necessary Spring resources (panel, service interface, etc.) manually, which is also a lot. I partially solved this by writing a static getter for the most common Spring beans for a class that has access to the application context.

What is the problem of configuring Spring to control actions and forms? In our application, the panel was simply defined as a presentation property in the application configuration, nothing special about it.

+1
source

All Articles