Java GUI programming tutorial part 2

As mentioned in this thread, I am making a Java GUI tutorial. Part 2 is now up. You can access it at http://markbernard.wordpress.com/2012/08/19/java-gui-made-easy-part-2/

All comments are welcome, either here or in the tutorial post.

Looks good, however your code goes off the “paper” (white space) ;D.

I believe wordpress has code tags.

Thanks guys. Temporarily fixed code going off the screen. I haven’t looked into Wordpress tags yet. Will have to do that next.

Ok. Found out how to highlight sourcecode properly for Wrodpress. Both posts have been updated.

btw is there anything equivalent to NetBeans’s “Swing GUI Builder” for Eclipse ?
I found JFormDesigner, but its commercial.
Is WindowBuilder Pro good ?

Eclipse has it’s own Gui Builder now. Works for SWT or Swing (And some GWT magic too afair).
Imho the NetBeans’s one is faster, the one in Eclipse is kinda slow on a lot of GUI-Elements (could be my laptop tho).

The netbeans gui builder (Matisse) has a very nice UI, but the code it generates is unmaintainable. Eclipse’s old VE had much nicer generated code, but the builder interface itself was a disaster. I don’t know about the code output of WBP, but it has to be better than Matisse.

Swing has been completely superseded by JavaFX already. Why would you work on new tutorials on Swing at this point?

It still makes sense to use Swing as a shim to a bare-bones canvas or OpenGL context, but actually doing menus and Swing components in a non-legacy codebase doesn’t make sense any more.

Not entirely, JavaFX is still lacking useful GUI components and on top of that: it is lacking a solid documentation base (quickly growing though). Swing still has its uses, even if they quickly reduce to “quick & dirty” kind of stuff.

As to why: I guess it is “because I can”.

What useful GUI components is JavaFX lacking? It seems to have all the basics. I wrote a JavaFX app and the API docs seemed fine. There is a dearth of code examples on the Internet, of course.

Part of this is also an exercise for me in writing. I know Swing a lot better than JavaFX. I also haven’t been following that JavaFX has been brought into Java 7 as part of desktop UI. I thought it was still just for web UIs. So once I finish the Swing part I am going to write it in JavaFX so I can learn the ins and outs of JavaFX.

Idk. I feel like javaFX is just reinventing the wheel to run a little better. If people already know how to use Swing to do all sorts of thing, why switch to javaFX? Is it that much of performance/work flow boost?

Strictly speaking, it’s shipped with Oracle’s Java, but not planned to be a core part of Java SE until Java 9. Swing isn’t going anywhere (possibly in both senses! :wink: ) for a while.

Actually after making that statement (that’s the way to do it - first moan and then verify) I was checking over the JavaFX 2.2 docs and I must say it looks pretty complete now. I was leaning on my memories of JavaFX 2.0 to be honest.