问题
I am going to design Java Desktop Application. While I was design web application, I got plenty of choice, e.g. Spring, Strut etc. However, for Java Desktop (which is new to me), I don't find any.
Is that Eclipse RCP a Java Desktop Framework, which works like Spring mvc in Web apps? I wonder, can I use Spring to enjoy the benefit of IOC, together with Eclipse RCP to enjoy the benefit of both world?
Please advise. Thanks.
回答1:
In java desktop land, you have 2 major choices : Swing or SWT. I'm ignoring AWT on this one. QTJambi is not that used in Java.
Most Java desktop applications use Java Swing. Nothing is preventing you from using an IOC container in a desktop application. In general, IOC container are used mostly to store event listeners, actions in desktop applications and barely UI components.
There are many attempts to create Swing RCP frameworks but most Java desktop applications kind of roll their own.
回答2:
You definitely can use Spring and reap the benefits of its various features including IoC. Spring is definitely not confined to the webworld, that's one of its great selling features is it's the swiss army knife of Java frameworks.
回答3:
You realize, of course, that SWT is not portable the way that Swing is.
Yes, you can use Spring with SWT, but there's no built-in MVC framework to help you. You might find the Spring Rich Client module helpful.
Here's a simple example - one person's opinion.
来源:https://stackoverflow.com/questions/1087526/can-spring-and-swt-work-together-for-java-desktop-applications