This question already has answers here:
Drawing a simple line graph in Java
(6 answers)
Closed 7 years ago.
I want to draw a Line Chart out of a double Array, what's the best way to do it in swing? Is there something like in JavaFX?:
series.getData().add(new XYChart.Data(1, 23));
Or should is the best way to implement a Java FX Line Chart in Swing? It's not a duplicate, because I want to know what the better is to go.
Use a JFX Panel on a normal JPanel, in the Oracle Documenation you can finde more Information about it.
JFXPanel is the component that will help Java Fx content to embed in Java swing application
See This. You can read the tutorial here
Which one is better?
If you will use JavaFx just delete Swing in your project. JavaFx is new and have a lot of components fast and useful. Swing is always behind it.
Including two jars?
It is like going somehere with two car. When you add JavaFx to your Swing project you have to find compatible jars Swing and JavaFx. And it is expensive for your project. You got two library and these are doing same thing.
What you can do, what will you see?
I think you are using Swing with JDK 1.6. or 1.7 And you can use JavaFx 2.2 but DON'T FORGET if you use that JavaFx you have to install JavaFx Runtime to your computer. And not only you! You have to install Runtime to other users which are using your jnlp.
And if your structure based on JDK 1.8 there is no problem. Java 8 have JavaFx SDK.
And when you add JavaFx to Swing some components will not work or will work slowly.
What i suggest?
Use one library! Choose one and just it. Change your Swing Project to JavaFx project because it future of Java Desktop Application.
And if you don't want to change your project don't use JavaFx then. Use swing components.
Related
Oracle announce that, javafx will not package with java 11. Whats about java swing.
Netbeans try to introduce Apache Netbeans IDE 9 which will work jdk 9+. Can i work its palette that help to drag and drop swing components. Please Help to make decision.
Currently i am working a big project completely designed with swing. And its already in market.
Yes, Java 11 includes Swing. See the docs: https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/package-summary.html
I need to integrate a browser in a JInternalFrame. I tried a lot of different ideas:
jcef: It is based on heavyweight components an so don't work with swing
jxBrowser: is only compatible to java 8
swt Browser: works in a JFrame but not JInternalFrame, Problem is described in this question
Does someone has another Idea how to integrate a browser to swing? It should be able to show Pages, which shows webGL and compatible with java 9 and 10.
I already saw some similar questions on SO, but those are 10 years and older and don't fit for my purpose
I found a solution and it worked with The DJ Project. It contains a library, that uses the swt browser and has a API for Java Swing applications.
i am using ArcGIS Library for a geospatial project. the sample codes available in their website was fully in java Swing. i need to do path animation in it using javaFX. is it possible.? if yes, can any one suggest me a sample code to create a map.?
Sample code for creating a map in Swing
I don't think you can pull this off using JavaFX, since JMap extends JComponent and is a class provided by the ArcGIS. Unless, they release a version which is supporting JavaFX, things are not very good.
The least you can do is to embed this JMap into a JavaFX application using SwingNode. An example on how to achieve this can be found here.
I am not sure what you want to achieve, when you say "path animation in it", but if it has something that can be achieved without using the internal components of JMap, you can do it !
JMap is a Swing component. JavaFX 1 was built on Swing and supported wrapping a Swing component. JavaFX 2 does not use Swing and does not support wrapping a Swing component. It is anticipated that the upcoming JavaFX 8 will support using Swing components in a JavaFX application.
UPDATE: ArcGIS Runtime is getting support for JavaFX! See http://blogs.esri.com/esri/arcgis/2014/09/17/arcgis-runtime-plays-at-10-2-4/ for details.
You have some options:
Go back to JavaFX 1 (not a good idea IMO)
Turn it around and use JavaFX components in a Swing application (see http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm)
Wait for Java 8, or go get the developer preview of Java 8.
Wait for ArcGIS Runtime 10.2.4 (to be released any day now), which will have beta support for JavaFX.
Sources:
How to wrap a swing component in a javaFX 2.0 application
Class SwingNode (JavaFX 8)
Maybe a bit late but... ArcGIS Runtime for Java's latest beta (Quartz) offers much more JavaFX support.
https://developers.arcgis.com/java/beta/guide/release-notes-java.htm
I'm very curious about working with JavaFX and standard Java programming in the Netbeans IDE.
If I worked on a standard Java application with the standard GUI interface, and then I decided to apply some JavaFX effects to this application, what type of project would I need to create, or will I have to change my project to javaFX application (since I only decided to use javaFX) ?
What would be the difference if I already had decided I wanted to use JavaFX to my application? Would I create a standard java project and then import the javaFX external packages, or create a JavaFX project?
I'm never sure on what project to create if I decided to use JavaFX.
Thanks much appreciated
JavaFx should be fully merged in SE 8 to 9. I had some troubles with adding jfx to existing projects in the beginning. There is currently no nice way, but the best way to add javafx to an old project is to create a new FX project and see this post.
The difference between a plain java project and an fx project is the template that is used and the dependecies (see above). So the real question is whether you need the skeleton code provided by the template. I found that it helped initially to get my bearings with FXML, but Scene Builder does much of that automagically.
I've heard rumors of people creating their own custom libraries for one, but I have yet to find one for myself. I need it because I need to mount another running applet (in a JPanel in Swing) for my application.
No, at least not in an officially supported way.
There is the SwingView in the ThingsFX 3rd party library to do this.
I've never tried it, so I can't recommend for or against it.
ThingsFX has a website.
Here is a screenshot of Swing components rendered on a JavaFX Stage using ThingsFX.