What is the difference between a \"normal\" Java desktop application (with AWT or Swing), and a Java application built with JavaFX?
What are the advantages and disadvant
JavaFX is improving faster and becoming better to use than Swing.
JavaFX is a framework for the GUI with several benefits, including animations and CSS integration. This can help in creating a lot of the 2D and near-3D stuff you can see in CSS3.
JavaFX is pure Java, so you need not learn another language other than the good old Java you know. JavaFX is my favorite GUI platform for desktop and enterprise, and I only use Swing when dealing with older application environments (i.e. integrating with hardware). The only disadvantage I know of is that the scene builder is not yet integrated, and using the controls and API requires some brain work, but this is minor.
For me there is no difference between Java desktop and JavaFX since JavaFX can be used to develop desktop apps, enterprise apps, and applets. You can look into the current JavaFX versions to check out its capabilities.
The JTable class is another Swing component that has no equivalent in AWT. JTable provides a very flexible possibility to create and display tables. Lets build tables from arrays or vectors of objects or from objects that implement the TableModel interface.
The JTableModel interface defines methods for objects that specify the contents of a table. The class provides an implementation AbstractTableModel the JTableModel predetermined interface. This class is typically extended to provide a custom implementation of model table. The JTable class provides the ability to edit tables. the method setCellEditor () allows an object of the interface is TableCellEditor identified as the editor table cells.
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class JavaExampleTableInJApplet extends JApplet
{
Object[] Dt = new Object[5];
DefaultTableModel DfltTblModl = new DefaultTableModel();
JTable Tbl = new JTable(DfltTblModl);
public void init()
{
for(int clmn = 0; clmn < 5; clmn++)
{
DfltTblModl.addColumn("Column"+clmn);
}
for(int row = 0; row < 10; row++)
{
for(int clmn = 0; clmn < 5; clmn++)
{
Dt[clmn] = "Cell " + row + "," + clmn;
}
DfltTblModl.addRow(Dt);
}
getContentPane().add(new JScrollPane(Tbl));
}
}
I think what you are asking is what are the pros and cons of building a JavaFX desktop application vs a Java Swing desktop application. After experimenting with both I can point out a few differences:
Java Swing
Pros:
Cons
JavaFX
Pros
Cons
Its not a disadvantage/advantage situation as much as understanding what each can provide and the old saying "use the right tool for the job".
Answer from yahoo answers Source for this answer:
javaFX is actually a different language (similar, but different syntax), but it runs on a JVM and can use Java classes. Mainly developed for "RIA" (rich Internet applications), across a variety of devices. Quite a few built-in features for developing fancy & flashy user-interfaces, without all the typing one has to do in a more nuts-n-bolts (low-level) language like Java.
Really, it's kinda hard to "compare"; JavaFX leverages all the advantages of Java & builds a platform on it for developing RIA's.
Source(s):
Javafx wikiepdia
javafx at a glance
javafx homepage
similar stackoverflow question