### Linear Gradient Syntax Examples Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html Examples demonstrating the syntax for creating linear gradients. This includes basic gradients from corner to corner, and more complex gradients with multiple color stops and defined start/end points. ```css linear-gradient(to bottom right, red, black) linear-gradient(from 0% 0% to 100% 100%, red 0%, black 100%) linear-gradient(from 0px 0px to 0px 50px, gray, darkgray 50%, dimgray 99%, white) ``` -------------------------------- ### libxml2 Meson Build Options Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/ThirdParty/libxml/src/README.md Example Meson build options for libxml2, as listed in `meson_options.txt`. These options control aspects of the build, such as the installation prefix, enabling history support, enabling HTTP support, disabling schematron, and enabling zlib. ```bash -Dprefix=$prefix -Dhistory=enabled -Dhttp=enabled -Dschematron=disabled -Dzlib=enabled ``` -------------------------------- ### Media Query Examples with Logical Operators Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html Illustrates the usage of media queries with different logical operators (not, and, or) and grouping using parentheses. These examples show how to combine media features for conditional styling in JavaFX. ```css @media not (prefers-color-scheme: light) { ... } ``` ```css @media (prefers-color-scheme: dark) and (prefers-reduced-motion) and (prefers-reduced-transparency) { ... } ``` ```css @media (prefers-color-scheme: dark) or (prefers-reduced-motion) or (prefers-reduced-transparency) { ... } ``` ```css @media (prefers-color-scheme: dark) and ((prefers-reduced-motion) or (prefers-reduced-transparency)) { ... } ``` ```css @media (prefers-color-scheme: dark) and (not (prefers-reduced-motion)) { ... } ``` -------------------------------- ### Radial Gradient Syntax Examples Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html Examples illustrating the syntax for defining radial gradients. This covers gradients radiating from a center point with specified radii and includes options for focus angle, distance, and reflection. ```css radial-gradient(radius 100%, red, darkgray, black) radial-gradient(focus-angle 45deg, focus-distance 20%, center 25% 25%, radius 50%, reflect, gray, darkgray 75%, dimgray) ``` -------------------------------- ### CMake Build Configuration for libxml2 (Windows focus) Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/ThirdParty/libxml/src/README.md This section provides example commands for building libxml2 on Windows using CMake. It demonstrates extracting the archive, configuring the build with specific options (like disabling Python or enabling zlib), building the project, running tests, and installing. ```bash cmake -E tar xf libxml2-xxx.tar.xz cmake -S libxml2-xxx -B builddir [options] cmake --build builddir ctest --test-dir builddir cmake --install builddir ``` -------------------------------- ### Image Pattern Usage Examples Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html Demonstrates how to use the `image-pattern` function to fill areas with an image. It shows variations with and without specifying the anchor rectangle and proportional scaling. ```css image-pattern("images/Duke.png") image-pattern("images/Duke.png", 20%, 20%, 80%, 80%) image-pattern("images/Duke.png", 20%, 20%, 80%, 80%, true) image-pattern("images/Duke.png", 20, 20, 80, 80, false) ``` -------------------------------- ### Build with Scons Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/WTF/wtf/dtoa/README.md Builds the static and shared libraries and installs them. The DESTDIR option can be used to specify an alternative installation directory. ```bash scons install scons DESTDIR=alternative_directory install ``` -------------------------------- ### Repeating Image Pattern Example Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html Provides an example of the `repeating-image-pattern` function, which is a shorthand for creating tiled image fills. It takes the image URI as its only parameter. ```css repeating-image-pattern("com/mycompany/myapp/images/Duke.png") ``` -------------------------------- ### JavaFX Animation Example with Transitions and Timeline Source: https://context7.com/openjdk/jfx/llms.txt This Java code demonstrates the use of JavaFX's animation framework. It includes examples of FadeTransition, TranslateTransition, ParallelTransition for concurrent animation execution, and Timeline with KeyFrames for defining complex animation sequences. The code requires the JavaFX SDK and application setup. ```java import javafx.animation.*; import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.util.Duration; public class AnimationExample extends Application { @Override public void start(Stage stage) { Pane root = new Pane(); root.setPadding(new Insets(20)); root.setPrefSize(600, 400); // Circle for transition animations Circle circle = new Circle(50, 50, 30, Color.BLUE); // Rectangle for timeline animation Rectangle rect = new Rectangle(50, 150, 50, 50); rect.setFill(Color.RED); root.getChildren().addAll(circle, rect); // FadeTransition FadeTransition fadeTransition = new FadeTransition(Duration.seconds(2), circle); fadeTransition.setFromValue(1.0); fadeTransition.setToValue(0.3); fadeTransition.setCycleCount(Timeline.INDEFINITE); fadeTransition.setAutoReverse(true); // TranslateTransition TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(3), circle); translateTransition.setFromX(0); translateTransition.setToX(500); translateTransition.setCycleCount(Timeline.INDEFINITE); translateTransition.setAutoReverse(true); translateTransition.setInterpolator(Interpolator.EASE_BOTH); // ParallelTransition - run both animations together ParallelTransition parallelTransition = new ParallelTransition( fadeTransition, translateTransition ); // Timeline with keyframes for complex animation Timeline timeline = new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(rect.translateXProperty(), 0), new KeyValue(rect.rotateProperty(), 0), new KeyValue(rect.fillProperty(), Color.RED) ), new KeyFrame(Duration.seconds(2), new KeyValue(rect.translateXProperty(), 300), new KeyValue(rect.rotateProperty(), 180), new KeyValue(rect.fillProperty(), Color.GREEN) ), new KeyFrame(Duration.seconds(4), new KeyValue(rect.translateXProperty(), 0), new KeyValue(rect.rotateProperty(), 360), new KeyValue(rect.fillProperty(), Color.BLUE) ) ); timeline.setCycleCount(Timeline.INDEFINITE); // Control buttons Button startBtn = new Button("Start Animations"); startBtn.setLayoutX(20); startBtn.setLayoutY(300); startBtn.setOnAction(e -> { parallelTransition.play(); timeline.play(); }); Button stopBtn = new Button("Stop Animations"); stopBtn.setLayoutX(140); stopBtn.setLayoutY(300); stopBtn.setOnAction(e -> { parallelTransition.stop(); timeline.stop(); }); root.getChildren().addAll(startBtn, stopBtn); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Animation Example"); stage.show(); } public static void main(String[] args) { launch(args); } } ``` -------------------------------- ### Create Minimal JDK with jlink (Failing Example) Source: https://github.com/openjdk/jfx/blob/master/doc-files/release-notes-11.md This command demonstrates the failing jlink configuration for creating a minimal JDK image that includes JavaFX Swing interop. It highlights the omission of necessary modules for successful operation. ```bash jlink --output myjdk --module-path javafx-jmods-11 \ --add-modules java.desktop,javafx.swing,javafx.controls ``` -------------------------------- ### Using Custom Control in Java and FXML (Code Examples) Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.fxml/src/main/docs/javafx/fxml/doc-files/introduction_to_fxml.html These examples show how to use the previously defined CustomControl. The Java snippet demonstrates instantiating the control, setting its text, and adding it to a layout. The FXML snippet shows how to include the CustomControl directly within another FXML file, treating it like any other JavaFX component. ```java HBox hbox = new HBox(); CustomControl customControl = new CustomControl(); customControl.setText("Hello World!"); hbox.getChildren().add(customControl); ``` ```fxml ``` -------------------------------- ### Shared Library Versioning and Installation (CMake) Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/JavaScriptCore/CMakeLists.txt This CMake code handles versioning and installation of the JavaScriptCore shared library. It checks if the platform is not 'Mac' and if the library type is 'SHARED', then populates version information and installs the target. ```cmake if (NOT "${PORT}" STREQUAL "Mac") if (${JavaScriptCore_LIBRARY_TYPE} STREQUAL "SHARED") WEBKIT_POPULATE_LIBRARY_VERSION(JAVASCRIPTCORE) set_target_properties(JavaScriptCore PROPERTIES VERSION ${JAVASCRIPTCORE_VERSION} SOVERSION ${JAVASCRIPTCORE_VERSION_MAJOR}) install(TARGETS JavaScriptCore DESTINATION "${LIB_INSTALL_DIR}") endif () endif () ``` -------------------------------- ### FXML Static Property Example Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.fxml/src/main/docs/javafx/fxml/doc-files/introduction_to_fxml.html Demonstrates the concise syntax for handling static properties in FXML. This approach is similar to static property elements and supports location, resource, and variable resolution operators. ```FXML ``` -------------------------------- ### FXML Instance Property Example (Button) Source: https://github.com/openjdk/jfx/blob/master/modules/javafx.fxml/src/main/docs/javafx/fxml/doc-files/introduction_to_fxml.html Demonstrates setting an instance property, 'text', on a Button element in FXML. This is a straightforward way to configure the initial state of UI controls. ```fxml