Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a 4 years old project which is written in Swing + SwingX. Currently, it is still alive and still kicking.

However, as more GUI related feature requests coming in (For instance, a sortable tree table), I start to feel the difficulty in fulling the requests. This is true especially since there isn't any active development going around SwingX project.

Also, I can hardly find any good, yet actively maintained/ developed/ evolving GUI Java framework.

I was wondering, do any of the Swing developers feel the same thing? Have you start to migrate your Swing project to a much more active developed GUI framework, like JavaFX?

share|improve this question
    
Have you looked into SWT? stackoverflow.com/questions/2306190/… –  FrustratedWithFormsDesigner May 11 '12 at 17:31
7  
It don't mean a thing if you ain't got that Swing. –  Robert Harvey May 11 '12 at 18:57
    
swing is cross-platform... javaFX2 isn't.. case closed. –  user61722 Aug 13 '12 at 11:42
    
@blanc it is available on Windows, Linux and OSX. YanChenhCHEOK, TreeTable is planned for JavaFX 8 (released with Java 8 later this year, possibly September). –  assylias Jan 12 '13 at 18:22
add comment

closed as not constructive by ChrisF Feb 15 '13 at 8:55

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

8 Answers

up vote 8 down vote accepted

I'm personally moving to JavaFX (2.1+, not the old weird 1.x version with the nasty scripting language). The new JavaFX isn't 100% perfect, but it's already a darn sight more pleasurable to use than Swing, I see a reasonable future for it (especially given the embedded Webkit engine).

share|improve this answer
add comment

I ask myself the same thing often, but I don't think I would migrate existing projects to JavaFX. At least not for now, and not for medium- to large-size projects. I would, however, considering JavaFX for new projects, and consider a migration again in the future and re-evaluate question based on JavaFX's progress.

At the moment, my concerns are:

  • Immaturity

    Yes, we're going to 3.0 soon, but it hasn't been around this long, and still went through major changes. So for large and risk-averse corporate software, this is a relatively sore spot.

  • Performance

    I haven't seen enough hard-data on performance differences.

  • Widgets and Components

    I haven't seen enough gain in the new components. This can relate to immaturity, I guess. I also don't know yet how well they can be extended and composited, in contrast with Swing.

Overall, I guess hard-data on the advantages is what I'm missing to be fully convinced by JavaFX.

On the other hand, Swing is proven and tested. Yes, the API is clunky and invoking the auto-completion in your IDE on a Swing object like the JTextPane will make it weep and cry for its mommy, but, if you're knowledgeable enough, you can build awesome UIs with Swing, that are performing well (I never bought the Swing-has-bad-performance fallacy, see Romain Guy's former blog posts on Sun's blogs) and allow you to do pretty neat things.

So, before switching anything, I'd recommend you try a small prototype first, and maybe try to port some of your application's dialogs and see how it goes.

share|improve this answer
add comment

I have been doing a lot of JavaFX now and I prefer it over Swing. The Scene Graph structure is different to what you're used to with Swing, but it provides so much improvements. The API is fun to work with, it feels refreshing.

There's so much more you can do with it, multimedia, animation, web browsing. You can for example build a Google Maps application in a few lines of code, embedding html5 and javascript.

It is said to be included in the Java 8 runtime, which would mean as the definate replacement of Swing as the default ui framework

@Migration: You should start by isolating parts of you application that can be converted to JavaFX. Swing-JavaFX 2 interoperability is a big thing, you can use the javafx.embed.swing.JFXPanel to embed your JavaFX element. See swing-fx-interoperability. (For completeness you can also embed in SWT.)

share|improve this answer
    
Don't try the swing-jfx interoperability thing, it is quite buggy. I tried it in my app, it works within netbeans but if i try to run the .jar directly, i get strange memory/threading related errors. Just start fresh in my opinion. –  Click Upvote Sep 23 '12 at 21:14
add comment

Swing is becoming a legacy technology, or is already. However, it's quite good in what it does and isn't going away in any foreseeable future, so I see no reason to move away from it, particularly if one has invested in it already. JIDE Software makes good (commercial) Swing components to replace what's missing from the standard Swing. For example, sortable treetable is in their Grids out of the box.

share|improve this answer
add comment

While the new JavaFX versions look very impressive, I doubt it is worth doing a full migration unless you are willing to invest a lot of time / effort / money in a complete overhaul of the GUI.

Swing may have its quirks and is showing its age but also it has some advantages:

  • Very strong cross-platform capability, currently much better than JavaFX
  • It's mature and proven, much more so than JavaFX
  • It has a large user community / library ecosystem
  • You probably already have lots of Swing skills or can hire people easily with them

Ultimately, if it isn't broken, why fix it?

Of course, for a new project I would be looking very seriously at JavaFX, Android and/or a web-based GUI (perhaps with something like Vaadin).

share|improve this answer
    
Are there any issues with JavaFX cross platform capabilities? –  Click Upvote Sep 23 '12 at 21:17
    
Last time I checked JavaFX was supported for Windows, Mac and Linux. If you are targeting other platforms beyond that, it is worth checking what the status is.... Swing is still (as of mid 2012) a safer bet if you are looking for broad cross-platform capability. –  mikera Sep 23 '12 at 23:59
    
what other platforms of interest are there? –  Click Upvote Sep 24 '12 at 5:21
add comment

I'm in the same position as the OP - having legacy swing applications but needing to implement new idioms and interfaces it does not natively support. The largest of these applications has been refactored a couple times for various reasons (improve modularity, better MVC and event dispatch structure, etc.) so I'm not completely averse to rewriting the UI code. So I've thought long and hard on the issue.

However, some things can't be solved with Swing without investing a lot more time and effort on what is essentially a legacy technology. For example, other than simple mouse events, new touch-screen devices and are unsupported by Swing itself. Providing a Swing based browser component is similarly troublesome or expensive, and in my case, the javafx-in-swing approach isn't an option as it complicates UI event handling in non-trivial ways.

I think it has been the old and faithful in its time, and if your platform is as unchanging as your code base - stick with it, obviously. But for an application to move forward into new more contemporary use cases, JavaFX 2+ will probably the way to move forward in my case.

As a side-note: the one misfeature in Swing I would have loved to have disappeared in jfx - but didn't - is the one-thread-to-rule-them-all approach to UI event dispatch. Any non-trivial user interface needs multi-threading to keep the UI crisp and responsive, and leaving it entirely up to the application developer to stumble over the same pitfalls so easily is a shortfall in the API IMHO.

share|improve this answer
add comment

I've had great experience using RCP in large, desktop-based applications. It basically started as an abstraction of Eclipse's GUI layer and has come a long way since then. Instead of Swing, which is based on AWT, RCP builds on JFace, which in turn is based on SWT. It allows you to develop applications and use the GUI concepts that Eclipse itself uses (views, editors, perspectives, wizards, etc.). It's very scalable and, like Eclipse itself, is constantly being improved.

However, I've never migrated an existing project from Swing to RCP; I'd imagine that it would take quite a while to wrap your head around the different paradigms and if you haven't separated your model and view layers well, you're bound to have a hard time. But since you asked about things like sortable tree tables, RCP is great at that.

If you'd like to reserach this further, you may want to try out Lars Vogel's tutorial or have a look at some examples of open source projects or commercial projects that use RCP.

share|improve this answer
add comment

(For instance, a sortable tree table), I start to feel the difficulty in fulling the requests. This is true especially there isn't active development going around SwingX project.

  • not true, again is this project alive,

  • blablabla once time when SwingX lost the grants by Sun (during aquiring by Oracle) peoples from SwingX went to built JavaFX

Also, I hardly can find any good, yet being actively maintained/ developed/ evolving GUI Java framework.

  • no Swing isn't about Framework but about Look and Feel

  • Frameworks are for non_technical users (MsAccess is may be the best example for GUI Framework)

  • but if you want to build an real application you have got strong knowledges about Swing and overriden came from Framework too,

  • funny example Netbeans has built_in Swing Framework based on JSR296, but there isn't able to change JFrames Icon directly,

Have you start to migrate your Swing project to a much more active developed GUI framework like JavaFX?

no reason why

  • same with migrating to Java7, maybe when will be there Java7.15 - 17

  • I'm compare JavaFx to with the Nimbus, development ended/give up somewhere in the first half

  • sorry I'm not developer I'm only Java & Swing Fan

share|improve this answer
    
MsAccess is GUI Framework? –  Cheok Yan Cheng Jun 9 '12 at 2:34
    
huuuuh isn't it??? whats problem, platforms differencies, or e.i.??? first Java GUI Frameworks were very similar –  mKorbel Jun 9 '12 at 7:31
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.