Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JavaFX Script vs. Swing: Are You Still Concerned?

DZone's Guide to

JavaFX Script vs. Swing: Are You Still Concerned?

· Java Zone
Free Resource

Find your next Integration job at DZone Jobs. See jobs focused on integration, or create your profile and have the employers come to you!

The concerns about the future of Swing and it's relation to JavaFX seem to be all over the place right now. However—if you look under the hood of JavaFX Script—all the widgets seem to wrap/need Swing components more or less directly. JavaFX Script seems to use Swing components as "Service Provider".

Some JavaFX samples (the declaration inside << >> refers to Java classes):

//JavaFX Button
public class Button extends Widget, RotatableWidget, ActionWidget {
private attribute button: <<net.java.javafx.ui.XButton>>;

//JavaFX Dialog
public class Dialog extends AbstractFrame {
private attribute jdialog:<<javax.swing.JDialog>>;

//JavaFX Script Frame
public class Frame extends AbstractFrame {

private attribute winListener: <<java.awt.event.WindowListener>>;
private attribute compListener: <<java.awt.event.ComponentListener>>;
private attribute frame: <<javax.swing.JFrame>>;
[I copied the samples from the NetBeans 6.0 JavaFX Plugin.]

The relationship between JavaFX Script and Swing is similar to the relationship between Swing and AWT or JFace and SWT: JavaFX Script is a decorator of Swing components.

However, JavaFX Script allows the usage of Swing components in a declarative way (without the setter-style) and in that way simplifies Swing development. From my perspective, JavaFX Script can be considered as a Domain Specific Language which compiles to Java 2D/Swing. With JavaFX Script, the development of Swing components becomes more fluent and object oriented... so that it is a nice complement and not a substitution. It is much easier to pimp up Swing apps with JavaFX with some visual effects.

I'm actually less concerned with the future of Swing: during the JavaONE 2008 technical sessions enough exciting, Swing related stuff was presented (JWebPane, Scene Graph, Java 6 update 10, Applets / WebStart etc.). ...and all cool IDEs like IntelliJ/NetBeans IDE are Swing-based :-).

From: blog.adam-bien.com

Find your next Integration job at DZone Jobs. See jobs focused on integration, or create your profile and have the employers come to you!

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}