### Canvas Initialization Example in JavaFX Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/canvas/GraphicsContext Demonstrates the basic setup of a JavaFX Canvas and its GraphicsContext for drawing operations. Includes setting fill color and drawing a filled rectangle. ```Java import javafx.application.Application; import javafx.scene.*; import javafx.scene.paint.*; import javafx.scene.canvas.*; import javafx.stage.Stage; public class CanvasExample extends Application { @Override public void start(Stage primaryStage) { 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); primaryStage.setScene(s); primaryStage.show(); } public static void main(String[] args) { launch(args); } } ``` -------------------------------- ### Application Lifecycle - Start Method Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/stage/class-use/Stage Details the `start` method in the `Application` class, which is the main entry point for JavaFX applications and receives a `Stage` object. ```APIDOC ## `abstract void` Application.start(Stage primaryStage) ### Description This is the main entry point for all JavaFX applications. It is called when the application is launched and receives a `Stage` object, which represents the main window of the application. ### Method `abstract void` ### Endpoint N/A (Method within JavaFX Application class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java public class MyScene extends Application { @Override public void start(Stage primaryStage) { // Application logic here } } ``` ### Response #### Success Response (N/A) This method does not return a value directly, but it is responsible for setting up the application's UI. #### Response Example N/A ``` -------------------------------- ### Light.Point Example Usage Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/effect/Light.Point Provides a code example demonstrating how to create and configure a Light.Point object. ```APIDOC ## Example ```java // Create a Point light source Light.Point light = new Light.Point(); light.setX(100); light.setY(100); light.setZ(50); // Apply the light to a Lighting effect Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(5.0); // Create a Text object and apply the effect Text text = new Text(); text.setText("Point"); text.setFill(Color.STEELBLUE); text.setFont(Font.font(null, FontWeight.BOLD, 80)); text.setX(10.0); text.setY(10.0); text.setTextOrigin(VPos.TOP); text.setEffect(lighting); // Create a Rectangle object and apply the effect Rectangle rect = new Rectangle(250, 150); rect.setFill(Color.ALICEBLUE); rect.setEffect(lighting); ``` ``` -------------------------------- ### Example Usage Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/shape/HLineTo A code example demonstrating how to use the HLineTo class within a Path. ```APIDOC ## Example ```java import javafx.scene.shape.*; Path path = new Path(); path.getElements().add(new MoveTo(0.0f, 0.0f)); path.getElements().add(new HLineTo(80.0f)); ``` ``` -------------------------------- ### Basic JavaFX Application Example Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/application/Application A simple JavaFX application demonstrating the structure required to extend the `Application` class. It overrides the `start` method to create a basic UI with a circle, a group, and a scene, then displays it in a stage. ```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(); } } ``` -------------------------------- ### Example Usage of FileChooser Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/stage/FileChooser An example demonstrating how to configure and use the FileChooser to open a file. ```APIDOC ## Example ```java FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open Resource File"); fileChooser.getExtensionFilters().addAll( new FileChooser.ExtensionFilter("Text Files", "*.txt"), new FileChooser.ExtensionFilter("Image Files", "*.png", "*.jpg", "*.gif"), new FileChooser.ExtensionFilter("Audio Files", "*.wav", "*.mp3", "*.aac"), new FileChooser.ExtensionFilter("All Files", "*.*")); File selectedFile = fileChooser.showOpenDialog(mainStage); if (selectedFile != null) { mainStage.display(selectedFile); } ``` ``` -------------------------------- ### Repeating Image Pattern Example Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/doc-files/cssref Shows a simple example of using the `repeating-image-pattern` function with a provided image URI. This creates a seamless tiled background using the specified image. ```CSS repeating-image-pattern("com/mycompany/myapp/images/Duke.png") ``` -------------------------------- ### Example of Animating Node with CacheHint in Java Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/Node Provides a Java code example demonstrating how to enable caching, set an initial cache hint, perform an animation, and then change the cache hint for smoother animation. This illustrates the trade-off between visual quality and animation performance. ```java expensiveNode.setCache(true); expensiveNode.setCacheHint(CacheHint.QUALITY); ... // Do an animation expensiveNode.setCacheHint(CacheHint.SPEED); new Timeline( new KeyFrame(Duration.seconds(2), new KeyValue(expensiveNode.scaleXProperty(), 2.0), new KeyValue(expensiveNode.scaleYProperty(), 2.0), new KeyValue(expensiveNode.rotateProperty(), 360), new KeyValue(expensiveNode.cacheHintProperty(), CacheHint.QUALITY) ) ).play(); ``` -------------------------------- ### Path Example Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/shape/Path A JavaScript code example demonstrating how to create and manipulate a Path object in JavaFX. ```APIDOC ## Path Creation Example ```java import javafx.scene.shape.*; Path path = new Path(); MoveTo moveTo = new MoveTo(); moveTo.setX(0.0f); moveTo.setY(0.0f); HLineTo hLineTo = new HLineTo(); hLineTo.setX(70.0f); QuadCurveTo quadCurveTo = new QuadCurveTo(); quadCurveTo.setX(120.0f); quadCurveTo.setY(60.0f); quadCurveTo.setControlX(100.0f); quadCurveTo.setControlY(0.0f); LineTo lineTo = new LineTo(); lineTo.setX(175.0f); lineTo.setY(55.0f); ArcTo arcTo = new ArcTo(); arcTo.setX(50.0f); arcTo.setY(50.0f); arcTo.setRadiusX(50.0f); arcTo.setRadiusY(50.0f); path.getElements().add(moveTo); path.getElements().add(hLineTo); path.getElements().add(quadCurveTo); path.getElements().add(lineTo); path.getElements().add(arcTo); ``` ``` -------------------------------- ### Radial Gradient Examples Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/doc-files/cssref Provides examples of radial gradient definitions. These demonstrate gradients with a specified radius, focus properties, center points, and the use of reflection for the gradient pattern. ```CSS radial-gradient(radius 100%, red, darkgray, black) ``` ```CSS radial-gradient(focus-angle 45deg, focus-distance 20%, center 25% 25%, radius 50%, reflect, gray, darkgray 75%, dimgray) ``` -------------------------------- ### Get From Y Coordinate for TranslateTransition (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/TranslateTransition Gets the starting Y coordinate of a TranslateTransition. The default value is Double.NaN. ```java double fromY = tt.getFromY(); ``` -------------------------------- ### Startup Method Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/application/Platform Explains how to manually start the JavaFX runtime using the startup method, including its parameters, exceptions, and usage context. ```APIDOC ## Method Details ### startup `public static void startup(Runnable runnable)` **Description:** This method starts the JavaFX runtime. The specified Runnable will then be called on the JavaFX Application Thread. It is generally not necessary to call this method directly, as it's often invoked automatically. However, there are use cases for manual invocation, especially when standard JavaFX application structures are not followed. This method can be called on the main thread. It may or may not return before the Runnable executes, but it does not block on the Runnable's completion. Subsequent calls to `runLater` will execute after the initial Runnable. **Important:** This method should only be called when the JavaFX runtime has not yet been initialized. Calling it when the runtime is already running will throw an `IllegalStateException`. **Note:** JavaFX classes must be loaded from named `javafx.*` modules on the module path; classpath loading is not supported. A warning is logged if classes are loaded from the classpath. **Parameters:** * `runnable` (Runnable) - The Runnable whose `run` method will be executed on the JavaFX Application Thread after the runtime starts. **Throws:** * `IllegalStateException` - If the JavaFX runtime is already running. **Since:** 9 **See Also:** * `Application` ``` -------------------------------- ### Get From Z Coordinate for TranslateTransition (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/TranslateTransition Gets the starting Z coordinate of a TranslateTransition. The default value is Double.NaN. ```java double fromZ = tt.getFromZ(); ``` -------------------------------- ### Get From X Coordinate for TranslateTransition (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/TranslateTransition Gets the starting X coordinate of a TranslateTransition. The default value is Double.NaN. ```java double fromX = tt.getFromX(); ``` -------------------------------- ### Get Animation Delay Property Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/Animation Sets or gets the ObjectProperty that delays the start of an animation. This property cannot be negative; attempting to set a negative value will result in an IllegalArgumentException. The default delay is 0ms. ```java public final ObjectProperty delayProperty ``` -------------------------------- ### Skin Interface Method Source: https://openjfx.io/javadoc/25/new-list Documentation for the `install` method of the `Skin` interface, called when a skin is set on a control. ```APIDOC ## Skin Interface Method ### Description Callback method invoked when a `Skin` is installed on a control. ### Method #### install() - **Description**: Called once when `Skin` is set. - **Endpoint**: Not applicable (method call) ``` -------------------------------- ### Manage Arc Start Angle in Java Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/shape/Arc Provides methods to get, set, and observe the starting angle of the arc in degrees. This defines where the arc begins its sweep. ```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 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 DoubleProperty startAngleProperty() Defines the starting angle of the arc in degrees. Default value: 0.0 Returns: the `startAngle` property See Also: * `getStartAngle()` * `setStartAngle(double)` ``` -------------------------------- ### Gloss Material Example (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/paint/PhongMaterial Demonstrates setting specular power to control the glossiness of a material. Lower specular power results in larger, softer highlights (less glossy), while higher power creates smaller, sharper highlights (more glossy). ```Java material.setDiffuseColor(Color.YELLOW.darker()); material.setSpecularColor(Color.WHITE); material.setSpecularPower(10); // Less glossy material2.setDiffuseColor(Color.RED.darker()); material2.setSpecularColor(Color.WHITE); material2.setSpecularPower(150); // More glossy ``` -------------------------------- ### Getting FadeTransition Start Value (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/FadeTransition Retrieves the starting opacity value of the FadeTransition. This indicates the opacity level at which the fading animation begins. The default value is Double.NaN. ```java FadeTransition fadeTransition = new FadeTransition(); double startOpacity = fadeTransition.getFromValue(); ``` -------------------------------- ### Linear Gradient Examples Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/doc-files/cssref Illustrates various ways to define linear gradients in CSS. Examples show gradients from corner to corner, with specified points, and complex multi-color stops with size constraints. ```CSS linear-gradient(to bottom right, red, black) ``` ```CSS linear-gradient(from 0% 0% to 100% 100%, red 0%, black 100%) ``` ```CSS linear-gradient(from 0px 0px to 0px 50px, gray, darkgray 50%, dimgray 99%, white) ``` -------------------------------- ### Get Start Y Coordinate of LinearGradient (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/paint/LinearGradient Retrieves the Y coordinate of the gradient axis start point. Similar to getStartX, if proportional is true, this value is scaled. This method defines the vertical origin of the gradient. ```java public final double getStartY() ``` -------------------------------- ### Ready State Event Handling Source: https://openjfx.io/javadoc/25/javafx.media/javafx/scene/media/MediaPlayer Manage the event handler for when the media player becomes ready. ```APIDOC ## POST /websites/openjfx_io_javadoc_25/setOnReady ### Description Sets the event handler that is invoked when the media player's status changes to `READY`. ### Method POST ### Endpoint /websites/openjfx_io_javadoc_25/setOnReady ### Parameters #### Request Body - **value** (Runnable) - Required - The ready event handler or `null` to clear it. ### Request Example ```json { "value": "// Your Runnable task here" } ``` ## GET /websites/openjfx_io_javadoc_25/getOnReady ### Description Retrieves the currently set ready event handler. ### Method GET ### Endpoint /websites/openjfx_io_javadoc_25/getOnReady ### Parameters This endpoint does not accept any parameters. ### Response #### Success Response (200) - **onReady** (Runnable) - The ready event handler or `null` if not set. #### Response Example ```json { "onReady": "// Your Runnable task here" } ``` ``` -------------------------------- ### Get Range Start of Text Change (Java) Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/TextFormatter.Change Obtains the starting index of a text modification within the control's text. The returned index is always greater than 0 and less than or equal to the total length of the text. ```java public final int getRangeStart() // Gets the start index into the `TextInputControl.getText()` for the modification. // Returns: The start index ``` -------------------------------- ### Image Pattern Examples Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/doc-files/cssref Demonstrates the usage of the `image-pattern` CSS function. Examples show defining patterns with just an image URL, with specified anchor rectangle dimensions, and with the proportional flag enabled or disabled. ```CSS image-pattern("images/Duke.png") ``` ```CSS image-pattern("images/Duke.png", 20%, 20%, 80%, 80%) ``` ```CSS image-pattern("images/Duke.png", 20%, 20%, 80%, 80%, true) ``` ```CSS image-pattern("images/Duke.png", 20, 20, 80, 80, false) ``` -------------------------------- ### Creating and Populating a Menu Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/Menu Examples of how to create a Menu and add items to it, including submenus. ```APIDOC ## Creating and Populating a Menu ### Creating a Menu and adding it to a MenuBar ```java Menu menu1 = new Menu("File"); MenuBar menuBar = new MenuBar(menu1); ``` ### Adding a MenuItem to a Menu ```java MenuItem menu12 = new MenuItem("Open"); menu1.getItems().add(menu12); ``` ### Supported MenuItem types The `items` ObservableList allows for any `MenuItem` type to be inserted, including its subclasses: - `Menu` - `MenuItem` - `RadioMenuItem` - `CheckMenuItem` - `CustomMenuItem` - `SeparatorMenuItem` In order to insert an arbitrary `Node` to a Menu, a `CustomMenuItem` can be used. One exception to this general rule is that `SeparatorMenuItem` could be used for inserting a separator. ``` -------------------------------- ### Get All Installed Printers (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/print/Printer Retrieves a set of all installed printers on the system. This method is useful for allowing users to select a printer for their print job. It returns an ObservableSet of Printer objects. ```java ObservableSet allPrinters = Printer.getAllPrinters(); ``` -------------------------------- ### Get On Edit Start Event Handler for TreeTableColumn Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/TreeTableColumn Retrieves the event handler that is triggered when a user successfully initiates editing for a cell in the TreeTableColumn. This is useful for performing actions or validations at the start of an editing session. ```java public final EventHandler> getOnEditStart() { // Returns the onEditStart event handler return null; } ``` -------------------------------- ### Example Usage: Custom LocalDateTime String Conversion (Java) Source: https://openjfx.io/javadoc/25/javafx.base/javafx/util/converter/LocalDateTimeStringConverter Demonstrates how to create a custom LocalDateTimeStringConverter using specific patterns for formatting and parsing. This example uses a fixed pattern for both operations. ```java String pattern = "yyyy-MM-dd HH:mm"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); // Assuming DateTimeStringConverter has a static method getLocalDateTimeConverter StringConverter converter = DateTimeStringConverter.getLocalDateTimeConverter(formatter, null); // Example usage: LocalDateTime now = LocalDateTime.now(); String formatted = converter.toString(now); System.out.println("Formatted: " + formatted); LocalDateTime parsed = converter.fromString(formatted); System.out.println("Parsed: " + parsed); ``` -------------------------------- ### Metal Material Example (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/paint/PhongMaterial Shows how to simulate metallic surfaces by setting the specular color to be similar to the diffuse color. The brightness of the specular color affects the perceived shininess. ```Java material.setDiffuseColor(Color.hsb(20, 85, 70)); material.setSpecularColor(Color.hsb(20, 85, 40)); // Dimmer specular for less shine ``` ```Java material2.setDiffuseColor(Color.hsb(41, 82, 92)); material2.setSpecularColor(Color.hsb(41, 82, 92)); // Specular matches diffuse for high shine ``` -------------------------------- ### XYChart Usage Example Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/chart/XYChart This snippet demonstrates how to install a Tooltip on a data item within an XYChart. ```APIDOC ## XYChart Data Item Tooltip Example ### Description This example shows how to attach a `Tooltip` to a specific data item node within an `XYChart` series. ### Method N/A (Code Snippet) ### Endpoint N/A (Code Snippet) ### Parameters N/A ### Request Example ```java // Assuming 'series' is an instance of XYChart.Series and contains data XYChart.Data item = (XYChart.Data) series.getData().get(0); Tooltip.install(item.getNode(), new Tooltip("Symbol-0")); ``` ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### FadeTransition: Set and Get byValue Property (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/FadeTransition Allows setting and getting the incremented stop opacity value for a FadeTransition. Changing byValue of a running animation requires restarting it. This value specifies the opacity change from the start value. ```Java public final DoubleProperty byValueProperty() { // Specifies the incremented stop opacity value, from the start, of this `FadeTransition`. // It is not possible to change `byValue` of a running `FadeTransition`. // If the value of `byValue` is changed for a running `FadeTransition`, // the animation has to be stopped and started again to pick up the new value. // Returns: the `byValue` property return byValue; } ``` ```Java public final double getByValue() { // Gets the value of the `byValue` property. // Property description: Specifies the incremented stop opacity value, from the start, of this `FadeTransition`. // It is not possible to change `byValue` of a running `FadeTransition`. // If the value of `byValue` is changed for a running `FadeTransition`, // the animation has to be stopped and started again to pick up the new value. // Returns: the value of the `byValue` property return byValue.get(); } ``` ```Java public final void setByValue(double value) { // Sets the value of the `byValue` property. // Property description: Specifies the incremented stop opacity value, from the start, of this `FadeTransition`. // It is not possible to change `byValue` of a running `FadeTransition`. // If the value of `byValue` is changed for a running `FadeTransition`, // the animation has to be stopped and started again to pick up the new value. // Parameters: `value` - the value for the `byValue` property byValue.set(value); } ``` -------------------------------- ### Platform Startup API Source: https://openjfx.io/javadoc/25/new-list API to start the JavaFX runtime, requiring a Runnable to be executed upon startup. ```APIDOC ## POST /javafx/application/Platform/startup ### Description Starts the JavaFX runtime. A Runnable can be provided to execute code once the runtime is ready. ### Method POST ### Endpoint /javafx/application/Platform/startup ### Parameters #### Request Body - **runnable** (Runnable) - Optional - The Runnable to execute after the JavaFX runtime has started. ### Request Example ```json { "runnable": "com.example.MyRunnable" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation that the JavaFX runtime has started. #### Response Example ```json { "message": "JavaFX runtime started successfully." } ``` ``` -------------------------------- ### Instantiate and Configure TreeTableView Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/TreeTableView Shows the process of creating a `TreeTableView` instance and setting its root `TreeItem`. It also covers defining `TreeTableColumn`s for specific data properties. ```java TreeTableView treeTable = new TreeTableView<>(root); TreeTableColumn fileNameCol = new TreeTableColumn<>("Filename"); TreeTableColumn sizeCol = new TreeTableColumn<>("Size"); treeTable.getColumns().setAll(fileNameCol, sizeCol); ``` -------------------------------- ### Starting a JavaFX Task with a Thread Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/concurrent/Task This example demonstrates how to create a new Thread for a Task, set it as a daemon thread, and start its execution. Daemon threads do not prevent the JVM from exiting. This approach is useful for background operations that should terminate when the application closes. ```java Thread th = new Thread(task); th.setDaemon(true); th.start(); ``` -------------------------------- ### Example of including a Button FXML Source: https://openjfx.io/javadoc/25/javafx.fxml/javafx/fxml/doc-files/introduction_to_fxml A practical example showing how to include a `Button` defined in a separate FXML file (`my_button.fxml`) into a `VBox`. It demonstrates the basic usage of ``. ```xml ``` -------------------------------- ### Get Document End Position (Java) Source: https://openjfx.io/javadoc/25/jfx.incubator.richtext/jfx/incubator/scene/control/richtext/model/StyledTextModel Returns the text position representing the very end of the document. The start of the document is accessible via the `TextPos.ZERO` constant. ```java public final TextPos getDocumentEnd() Returns the text position corresponding to the end of the document. The start of the document can be referenced by the `TextPos.ZERO` constant. Returns: the text position ``` -------------------------------- ### Transparency Material Example (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/paint/PhongMaterial Illustrates creating transparent or translucent materials using low alpha values in the diffuse color. The specular color's brightness influences the material's finish (glossy vs. matte). ```Java material.setDiffuseColor(Color.rgb(0, 0, 0, 0.3)); // Low opacity material.setSpecularColor(Color.hsb(0, 0, 45)); // Moderate brightness specular ``` -------------------------------- ### Get From Value from StrokeTransition (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/StrokeTransition Retrieves the starting color value (fromValue) of the StrokeTransition. This property cannot be modified during an active animation. ```Java public Color getFromValue() { // ... implementation details ... return null; } ``` -------------------------------- ### From Value Property Management Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/FillTransition Manage the starting color value for the FillTransition. This includes setting, getting, and observing changes to the fromValue property. ```APIDOC ## setFromValue ### Description Sets the value of the `fromValue` property. ### Method `public final void setFromValue(Color value)` ### Parameters - **value** (Color) - the value for the `fromValue` property ### See Also - `getFromValue()` - `fromValueProperty()` ## getFromValue ### Description Gets the value of the `fromValue` property. ### Method `public final Color getFromValue()` ### Returns - Color - the value of the `fromValue` property ### See Also - `setFromValue(Color)` - `fromValueProperty()` ## fromValueProperty ### Description Returns the `fromValue` property, which specifies the start color value for this `FillTransition`. ### Method `public final ObjectProperty fromValueProperty()` ### Returns - ObjectProperty - the `fromValue` property ### See Also - `getFromValue()` - `setFromValue(Color)` ``` -------------------------------- ### PointLight Constructors Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/PointLight Provides details on how to instantiate PointLight objects. ```APIDOC ## PointLight Constructors ### Description Constructors for creating a `PointLight` object. ### Constructor - `PointLight()`: Creates a new instance of `PointLight` class with a default `Color.WHITE` light source. - `PointLight(Color color)`: Creates a new instance of `PointLight` class using the specified color. ``` -------------------------------- ### TooltipSkin Methods Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/skin/TooltipSkin Documentation for the instance methods of the TooltipSkin class. ```APIDOC ## getSkinnable() ### Description Gets the Skinnable to which this Skin is assigned. A Skin must be created for one and only one Skinnable. This value will only ever go from a non-null to null value when the Skin is removed from the Skinnable, and only as a consequence of a call to `Skin.dispose()`. ### Method `GET` ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Tooltip** (Tooltip) - A non-null Skinnable, or null value if disposed. #### Response Example ```json { "skinnable": "Tooltip object" } ``` ## getNode() ### Description Gets the Node which represents this Skin. This must never be null, except after a call to `Skin.dispose()`, and must never change except when changing to null. ### Method `GET` ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Node** (Node) - A non-null Node, except when the Skin has been disposed. #### Response Example ```json { "node": "Node object" } ``` ## dispose() ### Description Called when a previously installed skin is about to be removed from its associated control. This allows the skin to do clean up, like removing listeners and bindings, and undo any changes to the control's properties. After this method completes, `Skin.getSkinnable()` and `Skin.getNode()` should return `null`. Calling `Skin.dispose()` more than once has no effect. ### Method `POST` (or conceptually a cleanup action) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Start X Coordinate of LinearGradient (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/paint/LinearGradient Retrieves the X coordinate of the gradient axis start point. If the proportional flag is true, this value is scaled to match the shape's bounds. This method is essential for understanding the gradient's origin. ```java public final double getStartX() ``` -------------------------------- ### FadeTransition FromValue API Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/animation/FadeTransition Provides methods to get and set the starting opacity value (fromValue) for a FadeTransition. This value cannot be changed while the animation is running. ```APIDOC ## GET /fadeTransition/fromValue ### Description Gets the starting opacity value of the FadeTransition. ### Method GET ### Endpoint /fadeTransition/fromValue ### Parameters #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **fromValue** (double) - The starting opacity value. #### Response Example ```json { "fromValue": 0.0 } ``` ## PUT /fadeTransition/fromValue ### Description Sets the starting opacity value for the FadeTransition. If the animation is running, it must be stopped and restarted for the new value to apply. ### Method PUT ### Endpoint /fadeTransition/fromValue ### Parameters #### Query Parameters None #### Request Body - **value** (double) - Required - The new starting opacity value. ### Request Example ```json { "value": 0.5 } ``` ### Response #### Success Response (200) - **message** (string) - Indicates success. #### Response Example ```json { "message": "FromValue updated successfully." } ``` ``` -------------------------------- ### JavaFX KeyBinding.Builder: Creating Key Bindings Source: https://openjfx.io/javadoc/25/jfx.incubator.input/jfx/incubator/scene/control/input/class-use/KeyBinding.Builder Demonstrates the static methods used to create a KeyBinding.Builder instance. These methods allow initialization with either a character or a KeyCode, serving as the foundation for defining custom key actions in JavaFX applications. ```Java KeyBinding.Builder builder = KeyBinding.builder("a"); // or KeyBinding.Builder builder = KeyBinding.builder(KeyCode.ENTER); ``` -------------------------------- ### PointLight Constructors Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/PointLight Provides details on how to instantiate a PointLight object. ```APIDOC ## PointLight Constructors ### PointLight (No Arguments) Creates a new instance of `PointLight` class with a default `Color.WHITE` light source. ### PointLight (Color color) Creates a new instance of `PointLight` class using the specified color. #### Parameters * **color** (Color) - The color of the light source. ``` -------------------------------- ### Stroke Dash Offset API Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/shape/Shape APIs for getting and setting the stroke dash offset, which determines the starting position within the dash pattern. ```APIDOC ## GET /websites/openjfx_io_javadoc_25/getStrokeDashOffset ### Description Retrieves the distance into the dashing pattern specified in user coordinates. ### Method GET ### Endpoint /websites/openjfx_io_javadoc_25/getStrokeDashOffset ### Parameters None ### Request Example None ### Response #### Success Response (200) - **double** - The distance specified in user coordinates representing an offset into the dashing pattern. #### Response Example ```json { "dashOffset": 45.0 } ``` ``` ```APIDOC ## POST /websites/openjfx_io_javadoc_25/setStrokeDashOffset ### Description Sets the offset into the dashing pattern. ### Method POST ### Endpoint /websites/openjfx_io_javadoc_25/setStrokeDashOffset ### Parameters #### Request Body - **dashOffset** (double) - Required - The distance in user coordinates to offset the dashing pattern. ### Request Example ```json { "dashOffset": 45.0 } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation of successful update. #### Response Example ```json { "message": "Stroke dash offset updated successfully." } ``` ``` -------------------------------- ### Get onRotationStartedProperty in JavaFX Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/Scene Returns the 'onRotationStarted' property, providing access to the handler for the start of a rotation gesture. This property is part of JavaFX 2.2 and later. ```java public final ObjectProperty> onRotationStartedProperty() ``` -------------------------------- ### BackgroundFill Constructor and Methods Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/layout/BackgroundFill Provides details on how to create and use the BackgroundFill class, including its constructor and getter methods. ```APIDOC ## BackgroundFill API Documentation ### Description Provides details on the `BackgroundFill` class, which represents the fill and associated properties for a `Region`'s background. It is an immutable class designed for safe use in caches and reuse. ### Constructor #### `BackgroundFill(Paint fill, CornerRadii radii, Insets insets)` Creates a new `BackgroundFill` with the specified fill, radii, and insets. Null values are acceptable; default values will be used in their place. * **Parameters**: * `fill` (Paint) - The paint to use for filling. If null, `Color.TRANSPARENT` is used. * `radii` (CornerRadii) - The corner radii. If null, `Radii.EMPTY` is used. * `insets` (Insets) - The insets. If null, `Insets.EMPTY` is used. ### Methods #### `getFill()` Returns the `Paint` used for filling the background of the `Region`. This value will never be null. * **Returns**: `Paint` - The fill paint. #### `getRadii()` Returns the `CornerRadii` used for representing the four radii of the `BackgroundFill`. This value will never be null, and radii values will never be negative. * **Returns**: `CornerRadii` - The corner radii. #### `getInsets()` Returns the `Insets` used for this fill, indicating the distance from the `Region`'s bounds where drawing should begin. This value will never be null, but insets can be negative. * **Returns**: `Insets` - The insets. #### `interpolate(BackgroundFill endValue, double t)` Returns an intermediate `BackgroundFill` value between this instance and the specified `endValue` using the linear interpolation factor `t` (0.0 to 1.0). * **Parameters**: * `endValue` (BackgroundFill) - The target value for interpolation. * `t` (double) - The interpolation factor, ranging from 0.0 to 1.0. * **Returns**: `BackgroundFill` - The intermediate value. * **Throws**: `NullPointerException` - if `endValue` is null. ``` -------------------------------- ### ContextMenu Constructors Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/ContextMenu Details on how to create a new ContextMenu instance. ```APIDOC ## ContextMenu Constructors ### ContextMenu ```java public ContextMenu() ``` **Description:** Creates a new ContextMenu. ### ContextMenu ```java public ContextMenu(MenuItem... items) ``` **Description:** Creates a new ContextMenu initialized with the given items. **Parameters:** * `items` (MenuItem[]) - The list of menu items. ``` -------------------------------- ### Get TreeTableView Focus Model (Java) Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/class-use/TreeTableView.TreeTableViewFocusModel Retrieves the currently installed FocusModel for a TreeTableView. The FocusModel provides API to control focus on rows. ```java final TreeTableView.TreeTableViewFocusModel getFocusModel() Returns the currently installed FocusModel. ``` -------------------------------- ### JavaFX XYChart.Data Constructor Examples Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/chart/XYChart.Data Demonstrates the creation of XYChart.Data objects using different constructor overloads. These constructors allow for initializing data points with or without an extra value. ```java import javafx.scene.chart.XYChart; // Creates an empty XYChart.Data object XYChart.Data emptyData = new XYChart.Data<>(); // Creates an instance with X and Y values XYChart.Data dataWithValues = new XYChart.Data<>(10, 20); // Creates an instance with X, Y, and an extra value XYChart.Data dataWithExtra = new XYChart.Data<>(15, 25, "Additional Info"); ``` -------------------------------- ### Get Scroll Started Event Handler (Scene) Source: https://openjfx.io/javadoc/25/javafx.base/javafx/event/class-use/EventHandler Retrieves the event handler for the `onScrollStarted` event on a Scene. This handler is invoked when a scroll gesture begins on the Scene. It returns an `EventHandler`. ```Java final EventHandler onScrollStarted = Scene.getOnScrollStarted(); ``` -------------------------------- ### ToolBar Example Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/ToolBar A code example demonstrating how to create and populate a horizontal ToolBar with buttons and separators. ```APIDOC ## Example Usage ```java ToolBar toolBar = new ToolBar( new Button("New"), new Button("Open"), new Button("Save"), new Separator(), new Button("Clean"), new Button("Compile"), new Button("Run"), new Separator(), new Button("Debug"), new Button("Profile") ); ``` ``` -------------------------------- ### TooltipSkin Constructor Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/skin/TooltipSkin Documentation for the constructor of the TooltipSkin class. ```APIDOC ## TooltipSkin(Tooltip t) ### Description Creates a new TooltipSkin instance for the given `Tooltip`. ### Method `TooltipSkin` ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Scroll Started Event Handler (Node) Source: https://openjfx.io/javadoc/25/javafx.base/javafx/event/class-use/EventHandler Retrieves the event handler for the `onScrollStarted` event on a Node. This handler is invoked when a scroll gesture begins on the Node. It returns an `EventHandler`. ```Java final EventHandler onScrollStarted = Node.getOnScrollStarted(); ``` -------------------------------- ### Get Rotation Started Event Handler (Scene) Source: https://openjfx.io/javadoc/25/javafx.base/javafx/event/class-use/EventHandler Retrieves the event handler for the `onRotationStarted` event on a Scene. This handler is invoked when a rotation gesture begins on the Scene. It returns an `EventHandler`. ```Java final EventHandler onRotationStarted = Scene.getOnRotationStarted(); ``` -------------------------------- ### Constructor Details Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/LightBase Information about the constructors available for creating instances of the LightBase class. ```APIDOC ## Constructor Details ### LightBase protected LightBase() Creates a new instance of `LightBase` class with a default Color.WHITE light source. ### LightBase protected LightBase(Color color) Creates a new instance of `LightBase` class using the specified color. **Parameters:** * `color` - the color of the light source ``` -------------------------------- ### Get Rotation Started Event Handler (Node) Source: https://openjfx.io/javadoc/25/javafx.base/javafx/event/class-use/EventHandler Retrieves the event handler for the `onRotationStarted` event on a Node. This handler is invoked when a rotation gesture begins on the Node. It returns an `EventHandler`. ```Java final EventHandler onRotationStarted = Node.getOnRotationStarted(); ``` -------------------------------- ### JavaFX Button Creation and Layout Example Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/Node Demonstrates the creation of a JavaFX Button, adding it to a scene graph, applying CSS, performing layout, and retrieving button dimensions. This snippet requires a JavaFX environment and a root node to be previously defined. ```java 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(); ``` -------------------------------- ### ComboBoxListViewSkin Constructor Example Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/skin/ComboBoxListViewSkin This constructor creates a new instance of ComboBoxListViewSkin. It installs necessary child nodes and input mappings for event handling within the ComboBox control. ```java public ComboBoxListViewSkin(ComboBox control) { // Constructor implementation } ``` -------------------------------- ### Builder and Callback Interfaces Source: https://openjfx.io/javadoc/25/allclasses-index Documentation for Builder, BuilderFactory, and Callback. ```APIDOC ## Builder ### Description Interface representing a builder. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## BuilderFactory ### Description Interface representing a builder factory. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## Callback ### Description The Callback interface is designed to allow for a common, reusable interface to exist for defining APIs that requires a call back in certain situations. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### LightBase Methods Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/LightBase Summary of instance methods for the LightBase class, including getters and setters for properties. ```APIDOC ## Method Summary All MethodsInstance MethodsConcrete Methods Modifier and Type Method Description `final ObjectProperty` `colorProperty()` Specifies the color of light source. `final Color` `getColor()` Gets the value of the `color` property. `ObservableList` `getExclusionScope()` Gets the list of nodes that specifies the hierarchical exclusion scope of this light. `ObservableList` `getScope()` Gets the list of nodes that specifies the hierarchical scope of this light. `final boolean` `isLightOn()` Gets the value of the `lightOn` property. `final BooleanProperty` `lightOnProperty()` Defines the light on or off. `final void` `setColor(Color value)` Sets the value of the `color` property. `final void` `setLightOn(boolean value)` Sets the value of the `lightOn` property. ``` -------------------------------- ### Get StageStyle by Name (Java) Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/stage/class-use/StageStyle Illustrates how to retrieve a StageStyle enum constant by its string name. This is useful when the style name is known at runtime, for example, from configuration or user input. ```java import javafx.stage.StageStyle; // ... String styleName = "UNDECORATED"; try { StageStyle style = StageStyle.valueOf(styleName); System.out.println("Found style: " + style); } catch (IllegalArgumentException e) { System.err.println("No enum constant found for name: " + styleName); } ``` -------------------------------- ### floatValue() Method Implementation Example Source: https://openjfx.io/javadoc/25/javafx.base/javafx/beans/value/ObservableNumberValue Shows how to get a float representation of an ObservableNumberValue using the floatValue() method. This method returns the value as a float, with a standard cast if the underlying type is different. ```java /** * Returns the value of this {@code ObservableNumberValue} as a {@code float}. * If the value is not a {@code float}, a standard cast is performed. * * @return The value of this {@code ObservableNumberValue} as a {@code float} */ float floatValue(); ``` -------------------------------- ### JavaFX 'Hello World' Application Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/stage/Stage A simple JavaFX application demonstrating how to create and display a 'Hello World!' message using a Stage. This example initializes a Stage, sets its title, creates a Scene with a Text node, and shows the Stage. It requires the JavaFX library and must be run on the JavaFX Application Thread. ```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); } } ``` -------------------------------- ### Create and Configure ScrollPane with Content Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/ScrollPane This example demonstrates how to create a ScrollPane, set its preferred size, and assign a Rectangle node as its content. This is a basic setup for displaying scrollable content. ```java Rectangle rect = new Rectangle(200, 200, Color.RED); ScrollPane s1 = new ScrollPane(); s1.setPrefSize(120, 120); s1.setContent(rect); ``` -------------------------------- ### JavaFX Application Start Method Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/application/Application The `start()` method is the primary entry point for a JavaFX application. It is called on the JavaFX Application Thread after the `init()` method completes and the system is ready. This is where the application's user interface (UI) is typically set up by creating and showing the primary stage. ```java public abstract void start(Stage primaryStage) throws Exception The main entry point for all JavaFX applications. The start method is called after the init method has returned, and after the system is ready for the application to begin running. NOTE: This method is called on the JavaFX Application Thread. Parameters: ``` -------------------------------- ### Get Zoom Started Event Handler in Java Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/Node Retrieves the current event handler for when a zooming gesture is detected. This method is part of the JavaFX API and is available since version 2.2. It returns an EventHandler for ZoomEvent. ```java public final EventHandler getOnZoomStarted() Gets the value of the `onZoomStarted` property. Property description: 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()` ``` -------------------------------- ### Get Rotation Started Event Handler in Java Source: https://openjfx.io/javadoc/25/javafx.graphics/javafx/scene/Node Retrieves the current event handler for when a rotation gesture begins. This method is part of the JavaFX API and is available since version 2.2. It returns an EventHandler for RotateEvent. ```java public final EventHandler getOnRotationStarted() Gets the value of the `onRotationStarted` property. Property description: 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()` ``` -------------------------------- ### Control Constructor and Skin Property Management (Java) Source: https://openjfx.io/javadoc/25/javafx.controls/javafx/scene/control/Control This snippet demonstrates the protected constructor for the Control class and the management of its skin property. The skin is crucial for rendering and has a one-to-one relationship with the Control. It details the process of installing, disposing, and setting the skin, including error handling for mismatched skins. It also covers retrieving and setting the skin property. ```java protected Control() { // Constructor implementation details } public final ObjectProperty> skinProperty() { // Implementation for skin property return null; // Placeholder } public final void setSkin(Skin value) { // Implementation for setting skin } public final Skin getSkin() { // Implementation for getting skin return null; // Placeholder } ```