Content deleted Content added
mNo edit summary Tags: Reverted Visual edit Mobile edit Mobile web edit |
m →top: Updated latest version to 24.0.2 Tags: Mobile edit Mobile app edit Android app edit App section source |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1:
{{Infobox software
| name = JavaFX
Line 5:
| developer = [[Oracle Corporation]]
| released = {{Start date and age|2008|12|04}}
| latest release version =
| latest release date = {{Start date and age|
| latest preview version =
| latest preview date =
Line 26:
== Features ==
{{Outdated|part=Features|date=July 2023|reason=}}
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 [[application programming interface|APIs]] that are desktop or mobile-specific. For example, the JavaFX Desktop profile includes [[Swing (Java)|Swing]] and advanced visual effects. JavaFX places all its symbols in the namespace <code>javafx</code>.
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.
Line 52:
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 <code>javafx.application.Application</code> and <code>main()</code> calls <code>Application::launch</code> which internally calls <code>Application::start</code>, which is overriden by the main class and acts as the entry point of the application itself.
<syntaxhighlight lang="java">
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);
}
}
</syntaxhighlight>
== Components ==
The JavaFX platform includes the following components:
* The JavaFX [[Software development kit|SDK]]: Including among other things graphics, media services, rich text libraries, and the web view.
* [[NetBeans]] IDE for JavaFX: NetBeans with drag-and-drop palette to add objects with transformations, effects and animations plus a set of samples and best practices. For Eclipse users there is a community-supported plugin hosted on e(fx)clipse.
* JavaFX Scene Builder: This was introduced for JavaFX 2.1 and later. A user interface (UI) is created by dragging and dropping controls from a palette. The layout is saved as an FXML file, which is a special XML format.
=== Modules ===
JavaFX is split into the following [[Java Platform Module System|modules]].<ref>{{Cite web|url=https://openjfx.io/javadoc/24/|title=Overview (JavaFX)|website=openjfx.io}}</ref>
{| class="wikitable"
! Name !! Description
|-
| {{code|javafx.base}}
| Defines core APIs for the JavaFX UI toolkit (such as APIs for bindings, properties, collections, and events).
|-
| {{code|javafx.controls}}
| Defines the APIs for UI controls, charts, skins in the JavaFX UI toolkit.
|-
| {{code|javafx.fxml}}
| Defines the FXML APIs in the JavaFX UI toolkit.
|-
| {{code|javafx.graphics}}
| Defines scenegraph, animation, geometry, and other related APIs for the JavaFX UI toolkit.
|-
| {{code|javafx.media}}
| Defines media playback and audio content APIs for the JavaFX UI toolkit.
|-
| {{code|javafx.swing}}
| Defines JavaFX/[[Swing (Java)|Swing]] interop support APIs for the JavaFX UI toolkit.
|-
| {{code|javafx.web}}
| Defines WebView APIs for the JavaFX UI toolkit.
|-
| {{code|jdk.jsobject}}
| Defines APIs for [[JavaScript]] objects.
|-
| {{code|jfx.incubator.input}}
| Incubates mechanism for customising JavaFX controls.
|-
| {{code|jfx.incubator.richtext}}
| Incubates RichTextArea control for JavaFX.
|}
== History ==
|