JavaFX - Articles, Tutorials and Examples

11.08.2013

JavaFX - Alien Rallye.
This article describes how to parse the content of a SVG path element and create a set of JavaFX PathElements which are added to a javafx.scene.shape.Path. The idea behind this is that the JavaFX Path can be used to create a PathTransition. I used the Apache Batik parser to split the SVG path element and wrote my own PathHandler to create the PathElements. This means: Parse a SVG string M 150 50 L 550,50 A 50 50 0 0 1 600,100 L 600,350 and create PathElements (ArcTo, LineTo, MoveTo, CubicCurveTo).

JavaFX - Lottery Wheel.
This article shows how to use TranslateTransitions, FadeTransitions, Timelines and Timeline chaining to implement a simple lottery wheel where names rotate around a point. The wheel reduces its speed continuously and at the end the winner name is highlighted. The names are loaded from a simple text file and positioned around the middle point. The winner is indicated by an arrow which is created with a Path. The Font size and the Color of the names depends on the angle where they are placed around the circle...

JavaFX Puzzle Game.
The following article describes how to create a simple Puzzle game with JavaFX. In this example MouseEvents are used to trigger the move of a puzzle tile from one position to the next. The EventHandler is registered on a Rectangle with setOnMouseClicked. The colors of the tiles can be customized via a CSS file. Also a Property Binding is used to update the text value of a Label automatically...

How to use and extend the library JFXtras.
This article describes how to compile the latest version of the JFXtras library in your own IDE so it is possible to debug directly into the source code and make changes which can be contributed to the project. I describe several ways to import and build the JFXtras library with Netbeans, Eclipse, Gradle, the e(fx)clipse plugin and the Eclipse Gradle Integration. Also I explain how to use Git to fork and clone the repository so you can contribute new components or bug fixes to the project...

JavaFX - Fractal: The Mandelbrot and the Julia Set.
The following article describes how to paint the Mandelbrot and the Julia set with JavaFX. Also I explain how to change the colors of the graphical representations of the sets. Additional the look of the Julia set can be changed by adapting the function values...

JavaFX - Mandelbrot Set.
The following short article describes how to paint a Mandelbrot set with JavaFX. The Mandelbrot set will be painted into a javafx.scene.canvas.Canvas with the methods GraphicsContext.setFill() and GraphicsContext.fillRect()...

JavaFX - Dartboard with Shapes (Path, Arc, ArcTo, Circle) and Text.
The following article describes how to paint a dartboard with JavaFX. This article tries to describe how to use primitive shapes to paint a complex Scene with JavaFX. A side-effect is that you will learn how to use trigonometric functions like sine and cosine and place points at an arbitrary position on a circle. In the example, a Scene is created which contains some javafx.scene.shape.Circle objects, javafx.scene.shape.Arc...

JavaFX - Animation of Circles with a Timeline.
The following article describes how to animate objects in JavaFX. In the example, a Scene is created which contains some objects (javafx.scene.shape.Circle-Objects) which are flying around an imaginary middlepoint. The animation is realized with a JavaFX javafx.animation.Timeline and javafx.animation.TranslateTransitions to move the objects from one point to the next position around the orbit. The objects are styled by a CSS file which defines a...