### Simple JavaFX Application Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/application/Application This code snippet demonstrates a basic JavaFX application. It extends the `Application` class and overrides the `start` method to create a simple window with a circle. The example shows how to set up a `Stage`, `Scene`, and `Group` containing a `Circle` object. ```Java import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.shape.Circle; import javafx.stage.Stage; public class MyApp extends Application { public void start(Stage stage) { Circle circ = new Circle(40, 40, 30); Group root = new Group(circ); Scene scene = new Scene(root, 400, 300); stage.setTitle("My JavaFX Application"); stage.setScene(scene); stage.show(); } } ``` -------------------------------- ### JavaFX Spinner Initialization Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.controls/javafx/scene/control/Spinner Demonstrates how to create and initialize a JavaFX Spinner with a specified range and initial value. This is a common starting point for using the Spinner control. ```Java Spinner spinner = new Spinner(0, 10, 5); ``` -------------------------------- ### JavaFX Selection Start Index API Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/text/Text Documentation for managing the start index of a text selection in JavaFX. It covers setting, getting, and observing the `selectionStart` property. ```APIDOC setSelectionStart(int value): void Sets the value of the `selectionStart` property. Property description: The start index of the selection in the content. If the value is -1, the selection is unset. Default value: -1 Parameters: `value` - the value for the `selectionStart` property Since: 9 getSelectionStart(): int Gets the value of the `selectionStart` property. Property description: The start index of the selection in the content. If the value is -1, the selection is unset. Default value: -1 Returns: the value of the `selectionStart` property Since: 9 selectionStartProperty(): IntegerProperty The start index of the selection in the content. If the value is -1, the selection is unset. Default value: -1 Returns: the `selectionStart` property Since: 9 ``` -------------------------------- ### Java Publisher Example for Subscription Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.base/javafx/util/Subscription Example of a Java `Publisher` class demonstrating how to return a `Subscription` from its `subscribe` method. ```Java class Publisher { public Subscription subscribe(Consumer subscriber) { register(subscriber); // return a Subscription which unregisters the original subscriber return () -> unregister(subscriber); } } ``` -------------------------------- ### JavaFX Canvas Usage Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/canvas/Canvas Demonstrates how to create a Canvas, get its GraphicsContext, and perform basic drawing operations like filling a rectangle. This example requires JavaFX libraries. ```Java import javafx.scene.*; import javafx.scene.paint.*; import javafx.scene.canvas.*; Group root = new Group(); Scene s = new Scene(root, 300, 300, Color.BLACK); final Canvas canvas = new Canvas(250,250); GraphicsContext gc = canvas.getGraphicsContext2D(); gc.setFill(Color.BLUE); gc.fillRect(75,75,100,100); root.getChildren().add(canvas); ``` -------------------------------- ### Include FXML example with Button Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.fxml/javafx/fxml/doc-files/introduction_to_fxml An example illustrating how fx:include works by including a 'my_button.fxml' file into a VBox. The included file defines a simple Button. ```XML ``` -------------------------------- ### JavaFX CSS Button Opacity Transition Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/doc-files/cssref An example demonstrating how to apply a CSS transition to a button's opacity in JavaFX, changing it smoothly on mouse hover. ```JavaFX CSS .button { -fx-opacity: 0.8; transition-property: -fx-opacity; transition-duration: 0.5s; } .button:hover { -fx-opacity: 1; } ``` -------------------------------- ### JavaFX 24 Overview Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/input/class-use/KeyEvent Provides an overview of the JavaFX 24 framework, including navigation links to different sections of the documentation. ```Java Skip navigation links * Overview * Class * Use * Tree * New * Deprecated * Index * Search * Help ``` -------------------------------- ### JavaFX Label Example Usage Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.controls/javafx/scene/control/Label Demonstrates a basic example of creating and initializing a JavaFX Label with text. ```Java Label label = new Label("a label"); ``` -------------------------------- ### JavaFX TreeTableColumn Get On Edit Start Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.controls/javafx/scene/control/TreeTableColumn Details the `getOnEditStart` method for retrieving the event handler associated with the start of cell editing in a TreeTableColumn. This allows access to the currently set handler. ```APIDOC getOnEditStart public final EventHandler> getOnEditStart() Gets the value of the `onEditStart` property. Property description: This event handler will be fired when the user successfully initiates editing. Returns: the value of the `onEditStart` property See Also: * `setOnEditStart(EventHandler)` * `onEditStartProperty()` ``` -------------------------------- ### FadeTransition Code Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/animation/FadeTransition An example demonstrating how to use FadeTransition to create a fade animation for a Rectangle node. It sets the duration, start and end opacity values, cycle count, and auto-reverse property. ```Java import javafx.scene.shape.*; import javafx.animation.*; import javafx.util.Duration; import javafx.scene.paint.Color; ... Rectangle rect = new Rectangle (100, 40, 100, 100); rect.setArcHeight(50); rect.setArcWidth(50); rect.setFill(Color.VIOLET); FadeTransition ft = new FadeTransition(Duration.millis(3000), rect); ft.setFromValue(1.0); ft.setToValue(0.3); ft.setCycleCount(4); ft.setAutoReverse(true); ft.play(); ... ``` -------------------------------- ### MenuBar Usage Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.controls/javafx/scene/control/MenuBar Demonstrates how to create and populate a MenuBar with multiple menus. This example shows the basic instantiation and addition of Menu objects to the MenuBar. ```Java Menu menu1 = new Menu("File"); Menu menu2 = new Menu("Options"); Menu menu3 = new Menu("Help"); MenuBar menuBar = new MenuBar(menu1, menu2, menu3); ``` -------------------------------- ### WebView Class Overview Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.web/javafx/scene/web/WebView Provides an overview of the WebView class, including its description, property summary, field summary, constructor summary, and method summary. ```APIDOC WebView: Description: Overview of the WebView class. Property Summary: Lists all properties of the WebView class. Field Summary: Lists all fields of the WebView class. Constructor Summary: Lists all constructors for the WebView class. Method Summary: Lists all methods available in the WebView class. ``` -------------------------------- ### JavaFX Background Image Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/doc-files/cssref Provides a Java code example demonstrating how to set a background image using CSS styling in JavaFX. It shows the creation of a StackPane and applying a style with a URL to an image file. ```Java @Override public void start(Stage stage) { StackPane root = new StackPane(); root.setStyle("-fx-background-image: url(images/Duke.png);"); Scene scene = new Scene(root, 300, 250); stage.setScene(scene); stage.show(); } ``` -------------------------------- ### JavaFX Hello World Application Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/stage/Stage A basic JavaFX application demonstrating how to create a Stage, set its title, scene, and display it. This example shows the fundamental structure for a JavaFX application. ```Java import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; public class HelloWorld extends Application { @Override public void start(Stage stage) { Text text = new Text(10, 40, "Hello World!"); text.setFont(new Font(40)); Scene scene = new Scene(new Group(text)); stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.sizeToScene(); stage.show(); } public static void main(String[] args) { Application.launch(args); } } ``` -------------------------------- ### FadeTransition fromValue Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/animation/FadeTransition Sets or gets the starting opacity value for a FadeTransition. Changing this for a running animation requires restarting it. The default value is Double.NaN. ```APIDOC public final void setFromValue(double value) Sets the value of the `fromValue` property. Property description: Specifies the start opacity value for this `FadeTransition`. It is not possible to change `fromValue` of a running `FadeTransition`. If the value of `fromValue` is changed for a running `FadeTransition`, the animation has to be stopped and started again to pick up the new value. Default value: `Double.NaN` Parameters: `value` - the value for the `fromValue` property See Also: * `getFromValue()` * `fromValueProperty()` public final double getFromValue() Gets the value of the `fromValue` property. Property description: Specifies the start opacity value for this `FadeTransition`. It is not possible to change `fromValue` of a running `FadeTransition`. If the value of `fromValue` is changed for a running `FadeTransition`, the animation has to be stopped and started again to pick up the new value. Default value: `Double.NaN` Returns: the value of the `fromValue` property See Also: * `setFromValue(double)` * `fromValueProperty()` public final DoubleProperty fromValueProperty() Specifies the start opacity value for this `FadeTransition`. It is not possible to change `fromValue` of a running `FadeTransition`. If the value of `fromValue` is changed for a running `FadeTransition`, the animation has to be stopped and started again to pick up the new value. Default value: `Double.NaN` Returns: the `fromValue` property See Also: * `getFromValue()` * `setFromValue(double)` ``` -------------------------------- ### JavaFX WebEngine Constructors Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.web/javafx/scene/web/WebEngine Details the constructors for creating a JavaFX WebEngine instance, allowing for initialization with or without a starting URL. ```APIDOC Constructor Summary: WebEngine(): Creates a new engine. WebEngine(String url): Creates a new engine and loads a Web page into it. ``` -------------------------------- ### JavaFX Application Lifecycle Methods Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/application/Preloader Lists key methods for managing the JavaFX application lifecycle, including initialization, launching, and stopping. ```APIDOC javafx.application.Application Methods declared in class javafx.application.Application: getHostServices: HostServices getParameters: Parameters getUserAgentStylesheet: String init(): void launch(String... args): void launch(Class appClass, String... args): void notifyPreloader(Preloader.PreloaderNotification info): void setUserAgentStylesheet(String url): void start(Stage primaryStage): void stop(): void ``` -------------------------------- ### Creating a CubicCurve in JavaFX Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/shape/CubicCurve An example demonstrating how to create and configure a CubicCurve object in JavaFX. It shows setting the start, end, and control points for the Bézier curve. ```Java import javafx.scene.shape.*; CubicCurve cubic = new CubicCurve(); cubic.setStartX(0.0f); cubic.setStartY(50.0f); cubic.setControlX1(25.0f); cubic.setControlY1(0.0f); cubic.setControlX2(75.0f); cubic.setControlY2(100.0f); cubic.setEndX(100.0f); cubic.setEndY(50.0f); } ``` -------------------------------- ### AudioClip Example Usage Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.media/javafx/scene/media/AudioClip Demonstrates how to create and play an AudioClip in JavaFX by loading an audio file from a URL and initiating playback. ```Java AudioClip plonkSound = new AudioClip("http://somehost/path/plonk.aiff"); plonkSound.play(); ``` -------------------------------- ### JavaFX Line Setters and Getters Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/shape/Line API documentation for methods to set and get the start and end coordinates of a JavaFX Line. Includes property accessors and mutators. ```APIDOC Method Details: setStartX(double value): Description: Sets the value of the startX property. Property description: The X coordinate of the start point of the line segment. Default value: 0.0 Parameters: value: the value for the startX property See Also: getStartX() startXProperty() getStartX(): Description: Gets the value of the startX property. Property description: The X coordinate of the start point of the line segment. Default value: 0.0 Returns: the value of the startX property See Also: setStartX(double) startXProperty() startXProperty(): Description: The X coordinate of the start point of the line segment. Default value: 0.0 Returns: the startX property See Also: getStartX() setStartX(double) setStartY(double value): Description: Sets the value of the startY property. Property description: The Y coordinate of the start point of the line segment. Default value: 0.0 Parameters: value: the value for the startY property See Also: getStartY() startYProperty() getStartY(): Description: Gets the value of the startY property. Property description: The Y coordinate of the start point of the line segment. Default value: 0.0 Returns: the value of the startY property See Also: setStartY(double) startYProperty() startYProperty(): Description: The Y coordinate of the start point of the line segment. Default value: 0.0 Returns: the startY property See Also: getStartY() setStartY(double) setEndX(double value): Description: Sets the value of the endX property. Property description: The X coordinate of the end point of the line segment. Default value: 0.0 Parameters: value: the value for the endX property See Also: getEndX() endXProperty() getEndX(): Description: Gets the value of the endX property. Property description: The X coordinate of the end point of the line segment. Default value: 0.0 Returns: the value of the endX property See Also: setEndX(double) endXProperty() endXProperty(): Description: The X coordinate of the end point of the line segment. Default value: 0.0 Returns: the endX property See Also: getEndX() setEndX(double) setEndY(double value): Description: Sets the value of the endY property. Property description: The Y coordinate of the end point of the line segment. Default value: 0.0 Parameters: value: the value for the endY property See Also: getEndY() endYProperty() getEndY(): Description: Gets the value of the endY property. Property description: The Y coordinate of the end point of the line segment. Default value: 0.0 Returns: the value of the endY property See Also: setEndY(double) endYProperty() endYProperty(): Description: The Y coordinate of the end point of the line segment. Default value: 0.0 Returns: the endY property ``` -------------------------------- ### TreeTableColumn Edit Event Types Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.controls/javafx/scene/control/TreeTableColumn Provides static methods to get event types for various editing actions in TreeTableColumn, such as starting, canceling, or committing an edit. ```APIDOC editAnyEvent() Returns: the edit event Parent event for any TreeTableColumn edit event. editStartEvent() Returns: the edit start event Indicates that the user has performed some interaction to start an edit event, or alternatively the `TreeTableView.edit(int, javafx.scene.control.TreeTableColumn)` method has been called. editCancelEvent() Returns: the edit cancel event Indicates that the editing has been canceled, meaning that no change should be made to the backing data source. editCommitEvent() Returns: the edit commit event Indicates that the editing has been committed by the user, meaning that a change should be made to the backing data source to reflect the new data. ``` -------------------------------- ### FXMLLoader Constructors Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.fxml/javafx/fxml/FXMLLoader Provides documentation for the different constructors of the FXMLLoader class, detailing the parameters they accept for initializing the loader. ```APIDOC FXMLLoader(URL location, ResourceBundle resources, BuilderFactory builderFactory, Callback,Object> controllerFactory, Charset charset) Creates a new FXMLLoader instance. Parameters: `location` - the location used to resolve relative path attribute values `resources` - resources used to resolve resource key attribute values `builderFactory` - the builder factory used by this loader `controllerFactory` - the controller factory used by this loader `charset` - the character set used by this loader Since: JavaFX 2.1 FXMLLoader(URL location, ResourceBundle resources, BuilderFactory builderFactory, Callback,Object> controllerFactory, Charset charset, LinkedList loaders) Creates a new FXMLLoader instance. Parameters: `location` - the location used to resolve relative path attribute values `resources` - resources used to resolve resource key attribute values `builderFactory` - the builder factory used by this loader `controllerFactory` - the controller factory used by this loader `charset` - the character set used by this loader `loaders` - list of loaders Since: JavaFX 2.1 ``` -------------------------------- ### HBox Example Usage Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/layout/HBox Demonstrates a basic example of creating and configuring an HBox in JavaFX, including setting spacing and adding child nodes. ```Java HBox hbox = new HBox(8); // spacing = 8 hbox.getChildren().addAll(new Label("Name:"), new TextBox()); ``` -------------------------------- ### JavaFX Zoom Event Handlers Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/Node Provides methods to set, get, and manage event handlers for zoom gestures in JavaFX. This includes handling the start of a zoom gesture. ```APIDOC setOnZoomStarted(EventHandler value) Sets the value of the `onZoomStarted` property. Defines a function to be called when a zooming gesture is detected. Parameters: `value` - the value for the `onZoomStarted` property Since: JavaFX 2.2 See Also: * `getOnZoomStarted()` * `onZoomStartedProperty()` getOnZoomStarted() Gets the value of the `onZoomStarted` property. Defines a function to be called when a zooming gesture is detected. Returns: the value of the `onZoomStarted` property Since: JavaFX 2.2 See Also: * `setOnZoomStarted(EventHandler)` * `onZoomStartedProperty()` onZoomStartedProperty() Defines a function to be called when a zooming gesture is detected. Returns: the event handler that is called when a zooming gesture is detected Since: JavaFX 2.2 See Also: * `getOnZoomStarted()` * `setOnZoomStarted(EventHandler)` setOnZoom(EventHandler value) Sets the value of the `onZoom` property. ``` -------------------------------- ### JavaFX Scene and Button Setup Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/Node This snippet demonstrates the basic setup of a JavaFX application window (stage) with a Scene containing a Button. It initializes a Scene, creates a Button with text, adds it to the root layout, applies CSS, performs layout, retrieves button dimensions, prints them, and finally sets the scene on the stage and shows it. ```Java Scene scene = new Scene(root); Button button = new Button("Hello World"); root.getChildren().add(button); root.applyCss(); root.layout(); double width = button.getWidth(); double height = button.getHeight(); System.out.println(width + ", " + height); stage.setScene(scene); stage.show(); ``` -------------------------------- ### StrokeTransition API Documentation Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/animation/StrokeTransition API reference for the StrokeTransition class, including its properties, constructors, and methods. Covers setting and getting the shape, duration, start and end values, and interpolation. ```APIDOC Class StrokeTransition java.lang.Object javafx.animation.Animation javafx.animation.Transition javafx.animation.StrokeTransition public final class StrokeTransition extends Transition This Transition creates an animation, that changes the stroke color of a shape over a duration. This is done by updating the stroke variable of the shape at regular intervals. It starts from the fromValue if provided else uses the shape's stroke value. (The stroke value has to be a Color in this case). It stops at the toValue value. Since: JavaFX 2.0 See Also: Transition, Animation Properties: Type Property Description final ObjectProperty duration The duration of this StrokeTransition. final ObjectProperty fromValue Specifies the start color value for this StrokeTransition. final ObjectProperty shape The target shape of this StrokeTransition. final ObjectProperty toValue Specifies the stop color value for this StrokeTransition. Properties declared in class javafx.animation.Transition: interpolator Properties declared in class javafx.animation.Animation: autoReverse, currentRate, currentTime, cycleCount, cycleDuration, delay, onFinished, rate, status, totalDuration Constructor Details: StrokeTransition(Duration, Shape, Color, Color) StrokeTransition(Duration, Color, Color) StrokeTransition(Duration, Shape) StrokeTransition(Duration) StrokeTransition() Method Details: setShape(Shape) getShape() shapeProperty() setDuration(Duration) getDuration() durationProperty() setFromValue(Color) getFromValue() fromValueProperty() setToValue(Color) getToValue() toValueProperty() interpolate(double) ``` -------------------------------- ### TreeTableColumn Cell Value Factory Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.controls/javafx/scene/control/TreeTableColumn Methods for setting and getting the cell value factory, which defines how cells in a TreeTableColumn are populated. Includes examples using Callback and TreeItemPropertyValueFactory. ```APIDOC setCellValueFactory(Callback,ObservableValue> value) Parameters: `value` - the value for the `cellValueFactory` property Sets the value of the `cellValueFactory` property. Property description: The cell value factory needs to be set to specify how to populate all cells within a single TreeTableColumn. A cell value factory is a `Callback` that provides a `TreeTableColumn.CellDataFeatures` instance, and expects an `ObservableValue` to be returned. The returned ObservableValue instance will be observed internally to allow for updates to the value to be immediately reflected on screen. An example of how to set a cell value factory is: ``` firstNameCol.setCellValueFactory(new Callback, ObservableValue>() { public ObservableValue call(CellDataFeatures p) { // p.getValue() returns the TreeItem instance for a particular TreeTableView row, // p.getValue().getValue() returns the Person instance inside the TreeItem return p.getValue().getValue().firstNameProperty(); } }); } ``` A common approach is to want to populate cells in a TreeTableColumn using a single value from a Java bean. To support this common scenario, there is the `TreeItemPropertyValueFactory` class. Refer to this class for more information on how to use it, but briefly here is how the above use case could be simplified using the TreeItemPropertyValueFactory class: ``` firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory("firstName")); ``` getCellValueFactory() Returns: the value of the `cellValueFactory` property Gets the value of the `cellValueFactory` property. Property description: The cell value factory needs to be set to specify how to populate all cells within a single TreeTableColumn. A cell value factory is a `Callback` that provides a `TreeTableColumn.CellDataFeatures` instance, and expects an `ObservableValue` to be returned. The returned ObservableValue instance will be observed internally to allow for updates to the value to be immediately reflected on screen. ``` -------------------------------- ### JavaFX Application Launch Methods Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/application/Application Provides methods for launching a JavaFX application. These are the entry points for starting the application lifecycle. ```APIDOC launch(Class applicationClass, String... args) - Launches a standalone application. - Parameters: - applicationClass: The class of the application to launch. - args: Command line arguments passed to the application. launch(String... args) - Launches a standalone application using the caller class. - Parameters: - args: Command line arguments passed to the application. ``` -------------------------------- ### JavaFX Rotation Event Handlers Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/Node Provides methods to set, get, and manage event handlers for rotation gestures in JavaFX. This includes handling the start, action, and end of a rotation. ```APIDOC setOnRotationStarted(EventHandler value) Sets the value of the `onRotationStarted` property. Defines a function to be called when a rotation gesture is detected. Parameters: `value` - the value for the `onRotationStarted` property Since: JavaFX 2.2 See Also: * `getOnRotationStarted()` * `onRotationStartedProperty()` getOnRotationStarted() Gets the value of the `onRotationStarted` property. Defines a function to be called when a rotation gesture is detected. Returns: the value of the `onRotationStarted` property Since: JavaFX 2.2 See Also: * `setOnRotationStarted(EventHandler)` * `onRotationStartedProperty()` onRotationStartedProperty() Defines a function to be called when a rotation gesture is detected. Returns: the event handler that is called when a rotation gesture is detected Since: JavaFX 2.2 See Also: * `getOnRotationStarted()` * `setOnRotationStarted(EventHandler)` setOnRotate(EventHandler value) Sets the value of the `onRotate` property. Defines a function to be called when user performs a rotation action. Parameters: `value` - the value for the `onRotate` property Since: JavaFX 2.2 See Also: * `getOnRotate()` * `onRotateProperty()` getOnRotate() Gets the value of the `onRotate` property. Defines a function to be called when user performs a rotation action. Returns: the value of the `onRotate` property Since: JavaFX 2.2 See Also: * `setOnRotate(EventHandler)` * `onRotateProperty()` onRotateProperty() Defines a function to be called when user performs a rotation action. Returns: the event handler that is called when user performs a rotation action Since: JavaFX 2.2 See Also: * `getOnRotate()` * `setOnRotate(EventHandler)` setOnRotationFinished(EventHandler value) Sets the value of the `onRotationFinished` property. Defines a function to be called when a rotation gesture ends. Parameters: `value` - the value for the `onRotationFinished` property Since: JavaFX 2.2 See Also: * `getOnRotationFinished()` * `onRotationFinishedProperty()` getOnRotationFinished() Gets the value of the `onRotationFinished` property. Defines a function to be called when a rotation gesture ends. Returns: the value of the `onRotationFinished` property Since: JavaFX 2.2 See Also: * `setOnRotationFinished(EventHandler)` * `onRotationFinishedProperty()` onRotationFinishedProperty() Defines a function to be called when a rotation gesture ends. Returns: the event handler that is called when a rotation gesture ends Since: JavaFX 2.2 See Also: * `getOnRotationFinished()` * `setOnRotationFinished(EventHandler)` ``` -------------------------------- ### JavaFX Media Constructor Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.media/javafx/scene/media/Media Details the constructor for the JavaFX Media class, which initializes a Media instance with a source URI. It outlines supported URL protocols, error handling for invalid sources, and potential exceptions during initialization. ```APIDOC Constructor Details: Media: public Media(String source) Constructs a `Media` instance. This is the only way to specify the media source. The source must represent a valid `URI` and is immutable. Only HTTP, HTTPS, FILE, and JAR `URL`s are supported. If the provided URL is invalid then an exception will be thrown. If an asynchronous error occurs, the `error` property will be set. Listen to this property to be notified of any such errors. If the source uses a non-blocking protocol such as FILE, then any problems which can be detected immediately will cause a `MediaException` to be thrown. Such problems include the media being inaccessible or in an unsupported format. If however a potentially blocking protocol such as HTTP is used, then the connection will be initialized asynchronously so that these sorts of errors will be signaled by setting the `error` property. Constraints: * The supplied URI must conform to RFC-2396 as required by java.net.URI. * Only HTTP, HTTPS, FILE, and JAR URIs are supported. See java.net.URI for more information about URI formatting in general. JAR URL syntax is specified in java.net.JarURLConnection. Parameters: `source` - The URI of the source media. Throws: `NullPointerException` - if the URI string is `null`. `IllegalArgumentException` - if the URI string does not conform to RFC-2396 or, if appropriate, the Jar URL specification, or is in a non-compliant form which cannot be modified to a compliant form. `IllegalArgumentException` - if the URI string has a `null` scheme. `UnsupportedOperationException` - if the protocol specified for the source is not supported. `MediaException` - if the media source cannot be connected (type `MediaException.Type.MEDIA_INACCESSIBLE`) or is not supported (type `MediaException.Type.MEDIA_UNSUPPORTED`). ``` -------------------------------- ### JavaFX 24 Packages Overview Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.base/javafx/beans/property/class-use/ObjectProperty Provides an overview of the main JavaFX 24 packages, including base functionalities and property management. ```Java package javafx.base; package javafx.beans.property; ``` -------------------------------- ### JavaFX Arc Angle and Length Properties Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/shape/Arc Provides methods to get, set, and observe the starting angle and angular extent (length) of the arc. Includes property accessors for binding. ```Java public final void setStartAngle(double value) Sets the value of the `startAngle` property. Property description: Defines the starting angle of the arc in degrees. Default value: 0.0 Parameters: `value` - the value for the `startAngle` property See Also: * `getStartAngle()` * `startAngleProperty()` ``` ```Java public final double getStartAngle() Gets the value of the `startAngle` property. Property description: Defines the starting angle of the arc in degrees. Default value: 0.0 Returns: the value of the `startAngle` property See Also: * `setStartAngle(double)` * `startAngleProperty()` ``` ```Java public final DoubleProperty startAngleProperty() Defines the starting angle of the arc in degrees. Default value: 0.0 Returns: the `startAngle` property See Also: * `getStartAngle()` * `setStartAngle(double)` ``` ```Java public final void setLength(double value) Sets the value of the `length` property. Property description: Defines the angular extent of the arc in degrees. Default value: 0.0 Parameters: `value` - the value for the `length` property See Also: * `getLength()` * `lengthProperty()` ``` ```Java public final double getLength() Gets the value of the `length` property. Property description: Defines the angular extent of the arc in degrees. Default value: 0.0 Returns: the value of the `length` property See Also: * `setLength(double)` * `lengthProperty()` ``` ```Java public final DoubleProperty lengthProperty() Defines the angular extent of the arc in degrees. Default value: 0.0 Returns: the `length` property See Also: * `getLength()` * `setLength(double)` ``` -------------------------------- ### SimpleIntegerProperty Constructors Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.base/javafx/beans/property/SimpleIntegerProperty Provides details for the various constructors of the SimpleIntegerProperty class, outlining the parameters required for initialization. ```Java public SimpleIntegerProperty() // The constructor of `IntegerProperty` ``` ```Java public SimpleIntegerProperty(int initialValue) // The constructor of `IntegerProperty` // Parameters: // `initialValue` - the initial value of the wrapped value ``` ```Java public SimpleIntegerProperty(Object bean, String name) // The constructor of `IntegerProperty` // Parameters: // `bean` - the containing `Object` or `null` // `name` - the name of this `IntegerProperty` ``` ```Java public SimpleIntegerProperty(Object bean, String name, int initialValue) // The constructor of `IntegerProperty` // Parameters: // `bean` - the containing `Object` or `null` // `name` - the name of this `IntegerProperty` // `initialValue` - the initial value of the wrapped value ``` -------------------------------- ### JavaFX Scroll Event Handlers Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/Scene Provides methods to set, get, and access the property for scroll events in JavaFX. This includes handling the start and end of scroll gestures. ```APIDOC setOnScroll(EventHandler value) Sets the value of the onScroll property. Parameters: value: the value for the onScroll property getOnScroll() Gets the value of the onScroll property. Returns: the value of the onScroll property onScrollProperty() Defines a function to be called when user performs a scrolling action. Returns: the onScroll property setOnScrollFinished(EventHandler value) Sets the value of the onScrollFinished property. Parameters: value: the value for the onScrollFinished property Since: JavaFX 2.2 getOnScrollFinished() Gets the value of the onScrollFinished property. Returns: the value of the onScrollFinished property Since: JavaFX 2.2 onScrollFinishedProperty() Defines a function to be called when a scrolling gesture ends. Returns: the onScrollFinished property Since: JavaFX 2.2 ``` -------------------------------- ### JavaFX Rotate Event Handlers Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/Scene Provides methods to set, get, and access the property for rotate events in JavaFX. This includes handling the start and end of rotation gestures. ```APIDOC setOnRotationStarted(EventHandler value) Sets the value of the onRotationStarted property. Parameters: value: the value for the onRotationStarted property Since: JavaFX 2.2 getOnRotationStarted() Gets the value of the onRotationStarted property. Returns: the value of the onRotationStarted property Since: JavaFX 2.2 onRotationStartedProperty() Defines a function to be called when a rotating gesture is detected. Returns: the onRotationStarted property Since: JavaFX 2.2 setOnRotate(EventHandler value) Sets the value of the onRotate property. Parameters: value: the value for the onRotate property Since: JavaFX 2.2 getOnRotate() Gets the value of the onRotate property. Returns: the value of the onRotate property Since: JavaFX 2.2 onRotateProperty() Defines a function to be called when user performs a rotating action. Returns: the onRotate property Since: JavaFX 2.2 setOnRotationFinished(EventHandler value) Sets the value of the onRotationFinished property. Parameters: value: the value for the onRotationFinished property ``` -------------------------------- ### JavaFX WebEngine API Documentation Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.web/javafx/scene/web/WebEngine This section provides API documentation for the JavaFX WebEngine, covering methods for printing, reloading, setting various handlers (confirm, popup, JavaScript, alert, error, resize, status, visibility, prompt), enabling JavaScript, setting user agent, user data directory, and user stylesheet location. ```APIDOC WebEngine: print(jobName: String) Prints the current Web page using the given printer job. promptHandlerProperty(): ObjectProperty> JavaScript `prompt` handler property. reload(): void Reloads the current page, whether loaded from URL or directly from a String in one of the `loadContent` methods. setConfirmHandler(handler: Callback): void Sets the value of the `confirmHandler` property. setCreatePopupHandler(handler: Callback): void Sets the value of the `createPopupHandler` property. setJavaScriptEnabled(value: boolean): void Sets the value of the `javaScriptEnabled` property. setOnAlert(handler: EventHandler>): void Sets the value of the `onAlert` property. setOnError(handler: EventHandler): void Sets the value of the `onError` property. setOnResized(handler: EventHandler>): void Sets the value of the `onResized` property. setOnStatusChanged(handler: EventHandler>): void Sets the value of the `onStatusChanged` property. setOnVisibilityChanged(handler: EventHandler>): void Sets the value of the `onVisibilityChanged` property. setPromptHandler(handler: Callback): void Sets the value of the `promptHandler` property. setUserAgent(value: String): void Sets the value of the `userAgent` property. setUserDataDirectory(value: File): void Sets the value of the `userDataDirectory` property. setUserStyleSheetLocation(value: String): void Sets the value of the `userStyleSheetLocation` property. titleProperty(): ReadOnlyStringProperty Title of the current Web page. userAgentProperty(): StringProperty Specifies user agent ID string. userDataDirectoryProperty(): ObjectProperty Specifies the directory to be used by this `WebEngine` to store local user data. userStyleSheetLocationProperty(): StringProperty Location of the user stylesheet as a string URL. ``` -------------------------------- ### ScrollEvent getTotalDeltaY Method Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/input/ScrollEvent Gets the cumulative vertical scroll amount for the entire gesture in pixels, relative to the gesture's start. This value is zero for mouse wheel scrolling. ```Java public double getTotalDeltaY() Gets the cumulative vertical scroll amount for the whole gesture. This value should be interpreted as a number of pixels to scroll relatively to the state at the beginning of the gesture. Contains zeros for mouse wheel scrolling. The sign of the value is reversed compared to the coordinate system (when you scroll down, the content actually needs to go up). So the returned value can be simply added to the content's `Y` coordinate. Returns: Number of pixels to scrolled vertically during the gesture Since: JavaFX 2.2 ``` -------------------------------- ### VBox Usage Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/layout/VBox Demonstrates how to create a VBox with a specified spacing and add children (Buttons in this case) to it. ```Java VBox vbox = new VBox(8); // spacing = 8 vbox.getChildren().addAll(new Button("Cut"), new Button("Copy"), new Button("Paste")); ``` -------------------------------- ### ScrollEvent getTotalDeltaX Method Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/input/ScrollEvent Gets the cumulative horizontal scroll amount for the entire gesture in pixels, relative to the gesture's start. This value is zero for mouse wheel scrolling. ```Java public double getTotalDeltaX() Gets the cumulative horizontal scroll amount for the whole gesture. This value should be interpreted as a number of pixels to scroll relatively to the state at the beginning of the gesture. Contains zeros for mouse wheel scrolling. The sign of the value is reversed compared to the coordinate system (when you scroll right, the content actually needs to go left). So the returned value can be simply added to the content's `X` coordinate. Returns: Number of pixels scrolled horizontally during the gesture Since: JavaFX 2.2 ``` -------------------------------- ### TextFlow Example Usage Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/scene/text/TextFlow Demonstrates how to create and populate a TextFlow with different Text nodes, applying various styles and fonts. ```java Text text1 = new Text("Big italic red text"); text1.setFill(Color.RED); text1.setFont(Font.font("Helvetica", FontPosture.ITALIC, 40)); Text text2 = new Text(" little bold blue text"); text2.setFill(Color.BLUE); text2.setFont(Font.font("Helvetica", FontWeight.BOLD, 10)); TextFlow textFlow = new TextFlow(text1, text2); ``` -------------------------------- ### FillTransition Usage Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.graphics/javafx/animation/FillTransition This code segment demonstrates how to create and play a FillTransition animation in JavaFX. It sets up a Rectangle, defines the start and end colors, duration, cycle count, and auto-reverse behavior. ```Java import javafx.scene.shape.*; import javafx.animation.*; import javafx.util.Duration; import javafx.scene.paint.Color; // ... Rectangle rect = new Rectangle (100, 40, 100, 100); rect.setArcHeight(50); rect.setArcWidth(50); FillTransition ft = new FillTransition(Duration.millis(3000), rect, Color.RED, Color.BLUE); ft.setCycleCount(4); ft.setAutoReverse(true); ft.play(); // ... ``` -------------------------------- ### JavaFX ContextMenu Usage Example Source: https://download.java.net/java/GA/javafx24/docs/api/javafx.controls/javafx/scene/control/ContextMenu Demonstrates how to create a ContextMenu, add menu items with event handlers, and associate it with a TextField. It also shows how to handle showing and shown events. ```Java final ContextMenu contextMenu = new ContextMenu(); contextMenu.setOnShowing(new EventHandler() { public void handle(WindowEvent e) { System.out.println("showing"); } }); contextMenu.setOnShown(new EventHandler() { public void handle(WindowEvent e) { System.out.println("shown"); } }); MenuItem item1 = new MenuItem("About"); item1.setOnAction(new EventHandler() { public void handle(ActionEvent e) { System.out.println("About"); } }); MenuItem item2 = new MenuItem("Preferences"); item2.setOnAction(new EventHandler() { public void handle(ActionEvent e) { System.out.println("Preferences"); } }); contextMenu.getItems().addAll(item1, item2); final TextField textField = new TextField("Type Something"); textField.setContextMenu(contextMenu); ```