Is JavaFX supposed to supersede Swing? - java

I am used to Swing programming and have heard about JavaFX. Is it supposed to replace Swing as the preferred platform for writing desktop applications in Java?
To put it in another way, should I choose JavaFX for my new project?

Yes JavaFX is replacing Swing.
See also official documentation of Oracle:
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6
Is JavaFX replacing Swing as the new client UI library for Java SE?
Yes. However, Swing will remain part of the Java SE specification for
the foreseeable future, and therefore included in the JRE. While we
recommend developers to leverage JavaFX APIs as much as possible when
building new applications, it is possible to extend a Swing
application with JavaFX, allowing for a smoother transition.
See also SO posts:
Swing vs JavaFx for desktop applications
https://stackoverflow.com/questions/1318645/javafx-or-swing (OLD)

Related

What new changes came with Swing in Java 8?

Are there any changes than came with Swing and AWT in Java 8? In release notes for Java 8 I it's not mentioned.
I don't think so...
Swing has really old API, oracle left it behind in favor of JavaFX - which does have (and still developed) methods that use the new APIs.
Edit: just remembered, the only new 'feature' that I know of that was added to swing is the JFXPanel which is a way of integrating JavaFX components into your app swing-fx-interoperability

Can JavaFX be included on a Java SE project?

I'm trying to create an Inventory project and have graphs on it. I'd like the graph to be created thru JavaFX and call it on a Java main class. Is it possible to add a JavaFX class to a Java project?
I'm using netbeans btw.
JavaFX for Java 7 is different from JavaFX on Java 8. My advice would be to go for Java 8. Then maybe NetBeans 8 too. JavaFX and swing/awt have different event threads, though under java 8 there seems to be a better integration.
JavaFX and java swing are two separate worlds. One might embed JavaFX in swing. Though if you are at the start of a basically new project, then you might go for pure JavaFX.
JavaFX uses "properties", wrapped values that can have change listeners on them / data binding. This separation from components makes dealing with the Model-View-Controller paradigm a bit nicer / different. JavaFX components themselves are a slightly more difficult, as swing provides a full API full of setters. It can be hard to make a column right-aligned for the first time. Another thing that makes JavaFX harder, is the use of callbacks with generic types, lambda expressions. Giving the correct signature not always is straight-forward.
So embedding JavaFX in swing might be a good approach if there is much swing experience or existing code: see
Embediing Swing in JavaFX (the other way around) and
How to Use JavaFX in Your Swing Application
If you mean, you have a NetBeans 7 Richt Client Application, then on the NetBeans.org there several small articles on JavaFX integration.

Difference between Java Swing application & Netbeans platform Swing

I want to develop a simple desktop application that connects to the Java DB , using Java Swing for the interface design.
I am new to Swing so I tried some tutorials on the net and came across
the Netbeans platform Swing components.
What is
the difference between the Java Swing architecture and the Netbeans Swing components?
Which one will be appropriate for developing interfaces
for desktop applications in Java?
From The NetBeans Platform:
The NetBeans Platform is a generic framework for Swing applications. It provides the "plumbing" that, before, every developer had to write themselves—saving state, connecting actions to menu items, toolbar items and keyboard shortcuts; window management, and so on.
It is an API built with Swing, that is supposed to provide some extra 'built-in' functionality. Since you need to know Swing to be able to use it. I suggest you concentrate on Swing for now.
Actually, it will be better to move on Intellij Idea from Jet Brains. It’s much more better than NetBeans IDE. Of course, it’s only my opinion.

What are the Java GUIs

I'm too far from Java technologies.
Just for curiosity what is the name of the technology/API/class which let us develop desktop applications with Java (like windows forms)?
I heard a toolkit named Swing. Is that the official GUI toolkit and is there any alternatives of Swing?
Is there a technology in Java corresponding to WPF of C#?
Java Swing is the most commonly used GUI toolkit for Java. There are alternatives (JavaFX, AWT, SWT), but Swing is a very good starting point if you start devolping desktop applications with Java. The only thing I would consider is looking at alternative LayoutManagers like MigLayout. But you can easily begin with the standard ones. There is a great visual guide to start off with Java Swing and the various LayoutManagers.
There is AWT, Swing, SWT, JavaFX, Android GUI.
The most common is Swing and while its not the prettiest, I would start with that unless you have specific requirements.
Java FX 2.x demo http://www.oracle.com/technetwork/java/javafx/samples/index.html
Java has the following options for GUI development:
(1) AWT
This is the old GUI development library
(2) Swing
This is the new GUI development library
(3) JavaFX
This is the latest GUI technology of Java,
it comes with FXML for fast UI development.
FXML is not compatible with XAML of .NET, but it can be considered equivalent.
Yes, Swing is the official GUI toolkit of the Java Runtime Environment.
in Java you can use many differen GUI technologies.
Swing is one of the technologies you can use. It is lightweight and it is the offical toolkit for Java.
Furthermore you can take a look at SWT, AWT or JMonkey for 3D stuff.
What do you mean with similar with WPF? The MVVM Pattern?
Something similar to Silverlight but better is the GWT Toolkit.

Desktop GUI framework

I tried to create a new Swing GUI desktop application template using NetBean 7.0 and just found NetBean has a disclaimer:
"Note that JSR-296 (Swing Application Framework) is no longer developed and will not become part of the official Java Development Kit as was originally planned. You can still use the Swing Application Framework library as it is, but no further development is expected."
So does it mean swing will stay the same from now on and nothing new will be added? What will that impact the applications using Swing? Do I need to consider other GUI frameworks instead? What would be the best framework option for a scientific plotting and graphic heavy application?
Thanks.
Swing is part of JAVA since 1.2 and it is part of the JAVA STANDARD. It is not going anywhere any time soon.
The JSR-296 (Swing Application Framework) was a framework to simplify and help developing in swing, which didnt go very far. Netbeans uses it internally. If using JAVA 7 then, like many other netbeans specific libraries, you need to ship it separately with you app, because it is not standard.
So, feel free to develop in swing. A pure swing app WILL WORK on any JAVA STANDARD on almost any platform for a long time to come. If you use the SAF, thats also OK, but that is not standard and its pretty much dead, so just remember to ship the jar with your app.
Hope that clarifies the situation.

Categories