Is JavaFX complete replacement of Swing? - java

I had a Java Desktop Application in which graphical user interface had designed in swing. After we came to know that JavaFX replacing Swing We have replaced graphical user interface with JavaFX.
"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 is included in the JRE. On one hand,
Swing is widely used in existing Java desktop applications, but relies
on an old architecture, which requires a certain level of expertise
and specialization. On the other hand, JavaFX features a set of modern
UI controls that can be skinned using standard CSS techniques. While
we recommend developers to leverage JavaFX APIs as much as possible
when building new applications, it is possible to use Swing and JavaFX
within the same application, allowing developers to extend existing
Swing applications."
Now we heard that Oracle donate the JavaFX toolkit to the open source community and OpenJDK Community had agreed to take it on.
The JavaFX toolkit evolved from the F3 project at Sun. Initial
releases were based around the JavaFX scripting language, however, in
2011 the toolkit was completely rewritten in Java and released by
Oracle as JavaFX 2.0. In October 2011 Oracle announced that it would
donate the JavaFX toolkit to the open source community and by November
2011 the OpenJDK Community had agreed to take it on.
I do not think so JavaFX is stable. It has no quick support. Document are not enough explanatory. It does not release internal memory when stage is closed. My application is multithreaded application and most of time taken by my application in updating status of each individual thread. Self contained copy of JRE in native bundle does not reliable, we have to replaced it with JRE folder that resides into JDK.
It's really frustrating and I wonder, if JavaFX is fit to develop the Java Desktop application.

According to Oracle, JavaFX is a replacement for Swing:
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6, question 6, says:
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.

Is JavaFX complete replacement of Swing?
I think that not,
most of components are halfsized in compare with Swing (price for development ???),
implementations in JavaFX8 (accesible with Java8) has one important point Swing JComponents could be accesible from JavaFX containers and JavaFX Components will be accesible in Swing JContainers (implemented in newer JavaFX2.2),
then JavaFX will be accesible for development of DeskTop applications
still question is if will be possible to add JavaFX TextArea together with Swing JTextArea in one JPanel or vice versa (Panel from xxx.scene.xxx)
more (the best infos, roadmap, development...) on FX Experience (notice occasionally is down :-)

Update as of 2020
JavaFX technology has been going quite well in the ensuing years after this Question was originally posted. Java is regularly released on its 6-month train schedule, and JavaFX releases have arrived at the same pace.
Oracle Corp. has completed the process of making JavaFX open-source, known as OpenJFX. The codebase is now housed as a sub-project on the OpenJDK project. Leadership has been assigned to the Gluon company, with Oracle’s continued support.
The popularity and community seem to be growing. The competitors have fallen away, such as Microsoft Silverlight and Adobe Flash both having died.
Oracle continues to support Swing as a required part of any Java SE implementation, but only in maintenance-mode. JavaFX, in contrast, is under constant active development.
Oracle sells support for JavaFX, as do other vendors such as Gluon and Azul Systems.
Some vendors supplying Java implementations bundle the JavaFX/OpenJFX libraries with their JVMs. These include Azul Systems with their ZuluFX product, and BellSoft with their LibericaFX product.
Though cutting-edge presently, there is work being done to build a native apps for iOS and other platforms using OpenJFX with ahead-of-time compilation using GraalVM.
Delivering a JavaFX desktop app is often done by bundling a JDK inside. This produces a “double-clickable” app. Bundling a JDK is more easily done by modularizing your code with JPMS. By leveraging JPMS, a developer can make use of the jlink and jpackage tooling.
See:
Java Client Roadmap Update by Oracle, 2020-05
JavaFX FAQ by Oracle
OpenJFX
JavaFX page on Wikipedia
OpenJDK wiki page for JavaFX

Related

Are applets dead?

A long time ago I made an applet, when I tried to a open it few days ago in website and it says that there is a security problem and it can not open it.
I Googled it and saw that I need to register it.
I tried to register it but nothing helped.
Can you explain what could make this problem?
The applet is fine and working when I run it from eclipse.
With recent updates to Java, security is much more strict. Your applet needs to be running the same java version and have a certificate. It's a very strict system...I can't open many java applets myself.
To make it run as an exception, copy the URL that the applet is on. Then open up your Java Control Panel, go to the Security Tab, and at the bottom hit Edit Site List at the bottom. From there, hit Add and paste in your link.
That'll allow it to run as an exception.
tl;dr
Java Applets are gone. You can modify your applet to run as a local app instead.
Today you can build local GUI apps in Java using your choice of three frameworks:
Swing (now in maintenance mode)
JavaFX (actively developed, led by Oracle and Gluon)
SWT (developed by the Eclipse Foundation)
For remote apps written in pure Java but delivered to users as a web app, see Vaadin Flow.
Yes, Java Applets are dead
Oracle has deprecated Java Applet technology, having proven too difficult to integrate securely into web browsers.
All the major web browser makers (Mozilla, Apple, Google, Microsoft, etc.) have phased out support for Java Applets.
Long live Java GUI apps
See white paper by Oracle, Java Client Roadmap Update, 2020-05.
Oracle’s vision for local Java GUI apps is for the developer to deliver a "double-clickable" app bundled with its own JVM slimmed down to include only needed parts. Modern tooling includes jlink and jpackage. Oracle no longer sees Java being generally bundled with operating systems, nor generally being installed by users.
While Java Applets are dead, Swing is still maintained as a required part of every Java implementation. People continue to write Swing apps for use on a local computer. You just cannot run a Swing app within a browser any longer. If you have source code for a Swing-based Applet, you can easily modify it to run as a local Swing app.
Swing’s replacement, JavaFX, is under very active development in the open-source project OpenJFX, a subproject hosted on the OpenJDK project. Releases arrive every six months, around the same time as Java releases.
The Eclipse Foundation continues to offer Standard Widget Toolkit (SWT) as a third platform (besides Swing & JavaFX) for writing Java GUI apps on a local computer.
For an open-source implementation of Java Web Start, see OpenWebStart. Oracle has dropped support for the technology, but others continue to find it a handy way to deliver and launch local Java desktop apps.
If you want to write web apps in pure Java using a Swing/JavaFX style of coding, see Vaadin Flow. Your app executes server-side in a JVM while the user-interface is automatically rendered remotely in the web browser by way of standard web technologies (HTML, CSS, JavaScript/ECMAScript/TypeScript, Web Components).

Does Jdeveloper 12 support creating Swing applications?

There is a tutorial at Oracle for creating a Swing application in Jdeveloper 11, but when I tried to follow that in Jdeveloper 12 there was no 'Java application' under 'Swing/AWT' branch of gallery. Is JD12 no longer supporting Swing apps or the process has changed?
It bills itself as a free integrated development environment that simplifies the development of Java-based SOA and Java EE applications
so I guess your answer would be, no, they aren't helping you make Swing-based applications. But that doesn't mean you can't, J2SE has all you (basically) need for Swing and you'd have to write against it anyway.
JDeveloper 12c support Swing development - in fact it includes new features for Swing development including the Matisse layout from NetBeans.
Create a new application of type "Java Desktop Application" and you'll see the wizards that you need to visually build Swing in JDeveloper. It's under "Client Tier" category.

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.

If Swing is deprecated, what is the alternative?

I heard that apparently Swing is being developed no longer. I like Swing and use it all the time.
What should I now be using instead?
I never heard such thing and still developing swing apps. Don't give wings to rumors.
But as an alternative you can use JavaFx or swt or buoy.
You probably read something about the 'Swing Application Framework', which while built using Swing, is not 'Swing'.
From Swing Application Framework - Status and Roadmap.
Development on an open source Reference Implementation called appframework was begun in 2006.[1] It was originally expected that this implementation would be the means for integrating JSR 296 into the upcoming Java SE 7 (Dolphin) version of the Java programming language, and the project was scheduled to be included in milestone 5 of the JDK7 development. However, in August 2009, it was announced that the project would not be included due to an inability to reconcile design flaws and achieve consensus among the JSR 296 team before the milestone 5 deadline.[2]
The original Swing Application Framework implementation has been put on hold indefinitely.[3] The last public release of the appframework project is version 1.03.[1]
Older question, but worth a reference:
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.
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6
Jan 2019 Latest
For reference, AWT & Swing have been moved to java.desktop since Java SE 9. You can watch for future changes here. JavaFX (added to JDK since 8) was removed from the official JDK in Java 11. So its hard to say what is "official" anymore. However JavaFX's development has increased since the decoupling, with its new home here.
The Standard Widget Toolkit.
There is nothing wrong with swing. Personally i don't like SWT. You have to read input-values from widgets and store them in normal variables before a dialog is disposed.

What platforms JavaFX is/will be supported on?

I have read about JavaFX, and like all new technologies I wanted to get my hands "dirty" with it. However, although it talks of multiplatform support, I can't find specifics on this.
What platforms support a JavaFX application? All those with Java SE? ME? Does it depend upon the APIs in JavaFX that I use?
JavaFX has three planned distributions.
JavaFX Desktop will run on Windows, Mac, Linux, and Solaris at FCS and will require Java SE. Support for Linux and Solaris will be forthcoming.
JavaFX TV and JavaFX Mobile have no announce target platforms. Also unannounced is whether they will run on ME or SE, and if ME which profiles.
One important platform distinction is that JavaFX Desktop will support Swing components while JavaFX Mobile will not (only scene graph for graphics). JavaFX TV the least publicly concrete of the three at this time.
From what I can see JavaFX is a whole new runtime and compiler so is not a subset of Java. Sun will support it on mobile phones and on the desktop.
OS-wise it is currently released for Windows/Mac but Solaris/Linux are in the works.
JavaFx is not a new runtime. It is the same JRE but a new language/compiler with some a few new APIs to make it all works....
Using Netbeans, you can build applications on any platform. As of today, the APIs are beta. Classfiles produced by the compiler are JRE 6 compatible.

Categories