JavaFX: Difference between revisions

Content deleted Content added
m Reverted edit by Amoniacc (talk) to last version by Fehufanga
No edit summary
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 97:
|Economics, psychology, education research
|}
 
=== Example ===
<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 ==