JavaFX 1.1 was based on the concept of a "common profile" that is intended to span across all devices supported by JavaFX. This approach makes it possible for developers to use a common programming model while building an application targeted for both desktop and mobile devices and to share much of the code, graphics assets and content between desktop and mobile versions. To address the need for tuning applications on a specific class of devices, the JavaFX 1.1 platform includes
APIs that are desktop or mobile-specific. For example, the JavaFX Desktop profile includes
Swing and advanced visual effects. JavaFX places all its symbols in the namespace javafx. For the end user, the "Drag-to-Install" feature enables them to drag a JavaFX widget - an application residing in a website - and drop it onto their desktop. The application will not lose its state or context even after the browser is closed. An application can also be re-launched by clicking on a shortcut that gets created automatically on the user's desktop. This behavior is enabled out-of-the-box by the Java applet mechanism since the Java 6u10 update, and is leveraged by JavaFX from the underlying Java layer. Sun touts "Drag-to-Install" as opening up of a new distribution model and allowing developers to "break away from the browser". JavaFX 1.x included a set of plug-ins for Adobe Photoshop and Illustrator that enable advanced graphics to be integrated directly into JavaFX applications. The plug-ins generate JavaFX Script code that preserves the layers and structure of the graphics. Developers can then add animation or effects to the static graphics imported. There is also an SVG graphics converter tool (also known as Media Factory) that allows for importing graphics and previewing assets after the conversion to JavaFX format. Before version 2.0 of JavaFX, developers used a statically typed, declarative language called
JavaFX Script to build JavaFX applications. Because JavaFX Script was compiled to
Java bytecode, programmers could also use
Java code instead. JavaFX applications before 2.0 could run on any desktop that could run
Java SE, just like it is with the current versions. JavaFX 2.0 and later is implemented as a Java library, and applications using JavaFX are written in normal Java code. The scripting language was discontinued by Oracle, however the development of it continued for a few years in the Visage project, finally ending in 2013. Sun Microsystems licensed a custom
typeface called Amble for use on JavaFX-powered devices. The font family was designed by
mobile user interface design specialist
Punchcut and is available as part of the JavaFX SDK 1.3 Release.
WebView WebView, the embedded
web browser component, uses the
WebKit browser engine. It supports the usual HTML5 features such as canvas, media, meter, progress, details and summary tags as well as MathML, SVG, JavaScript and CSS.
WebAssembly support is not enabled.
3D Since JavaFX 8, JavaFX has had 3D capablilities, such as dynamic lights, basic shapes, meshes, texture mapping, et cetera. these components can be integrated into scenes and subscenes.
JavaFX Mobile JavaFX Mobile was the implementation of the JavaFX platform for
rich web applications aimed at
mobile devices. JavaFX Mobile 1.x applications can be developed in the same language,
JavaFX Script, as JavaFX 1.x applications for browser or desktop, and using the same tools: JavaFX SDK and the JavaFX Production Suite. This concept makes it possible to share code-base and graphics assets for desktop and mobile applications. Through integration with
Java ME, the JavaFX applications have access to capabilities of the underlying handset, such as the
filesystem, camera,
GPS,
bluetooth or
accelerometer. An independent application platform built on Java, JavaFX Mobile is capable of running on multiple mobile operating systems, including
Android,
Windows Mobile, and proprietary
real-time operating systems. JavaFX Mobile was publicly available as part of the JavaFX 1.1 release announced by
Sun Microsystems on February 12, 2009. Sun planned to enable out-of-the-box support of JavaFX on the devices by working with handset manufacturers and mobile operators to preload the JavaFX Mobile runtime on the handsets. JavaFX Mobile running on an Android was demonstrated at
JavaOne 2008 and selected partnerships (incl.
LG Electronics,
Sony Ericsson) were announced at the JavaFX Mobile launch in February, 2009.
Example To launch a JavaFX application, the main class extends javafx.application.Application and main() calls Application::launch which internally calls Application::start, which is overridden by the main class and acts as the entry point of the application itself. package org.wikipedia.examples; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class JavaFXExample extends Application { @Override public void start(Stage primaryStage) { Button button = new Button("Click Me!"); button.setOnAction(e -> System.out.println("Hello from JavaFX!")); StackPane root = new StackPane(button); Scene scene = new Scene(root, 300, 200); primaryStage.setTitle("JavaFX Example"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } == Components ==