Irina is writing tutorials and technical articles on Java and JavaFX technologies. She lives in St. Petersburg, Russia. In my spare time I like swing dancing, playing the piano, and reading.
Returning to JavaFX 1.3, you can embed Swing in JavaFX, but not vice versa. At least it can not be officially done. I implemented a Swing component that embeds JavaFX content (called JXScene) in Swing and makes it available for publication in the jfxtras project. This is the only way to embed JavaFX scenes in Swing applications. Oracle with JavaFX 2.X incorporates the official method of JavaFX into Swing, but unfortunately we can not embed Swing in JavaFX. In most cases this is enough. However, in future JavaFX 8, you can also use the Swing node to embed swing components in JavaFX applications.
In general, you can see that the JavaFX control hierarchy is more complete than Swing. Both have all the basic controls, such as buttons, check boxes, combo boxes. However, there are several interesting controls in JavaFX other than Swing, including collapsible TitledPane control and Accordion control that allows you to place multiple TitledPane controls in the stack. Indeed, these controls are superior to Swing because they can all apply skins through CSS. In contrast, JavaFX supports complex animations that can be applied to any node in the scene graph. You can use one of several built-in transition classes to perform common animations such as fade, rotation, motion path, and so on. Alternatively, you can easily set up custom animations using the KeyFrame and Timeline classes.
It is unfair to completely fill out the 10 difference lists in that it clearly supports JavaFX. This is a minor bug in JavaFX. The JOptionpane class equivalent to Swing is not built in. This is useful for displaying short warning messages or for receiving simple input from the user. For JavaFX, you need to create your own equivalent of this handy class.
Swing does not support the latest touch device. In contrast, JavaFX supports common touch gestures such as scrolling, swiping, rotating, and zooming. Handling these events with JavaFX is as simple as handling other types of events. Simply install the event listener on the touch event and then write the appropriate response code. It is unfair to completely fill out the 10 difference lists in that it clearly supports JavaFX. This is a minor bug in JavaFX. The JOptionpane class equivalent to Swing is not built in. This is useful for displaying short warning messages or for receiving simple input from the user. For JavaFX, you need to create your own equivalent of this handy class.