How do you handle events in JavaFX?
Register JavaFX event handlers with setOnAction or addEventHandler, understand filters and bubbling, and handle keyboard, mouse and window events correctly.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Register JavaFX event handlers with setOnAction or addEventHandler, understand filters and bubbling, and handle keyboard, mouse and window events correctly.
SceneBuilder is a drag and drop designer that writes FXML for JavaFX apps. See how it separates UI from logic, with a complete controller and loader example.
Build JavaFX animations with FadeTransition, TranslateTransition, Timeline and AnimationTimer. Includes combining transitions, easing and performance tips.
JavaFX bindings keep properties in sync without listeners. Learn one-way and two-way binding and computed values with working code.
A practical guide to the JavaFX layout panes, with short examples for each, a comparison table and advice on nesting them for real screens.
Read text, selections and key presses in JavaFX with event handlers, listeners and TextFormatter, and keep the UI responsive with a Task for slow work.
The JavaFX Stage class is the top-level window of an application and holds one Scene. Learn its methods, styles, modality and multi-window use.
Set up JavaFX with Maven on a modern JDK, write a first Application with a button and label, and run it with mvn javafx:run or the module path.
Modular applications declare dependencies and exported packages that the compiler enforces. Non-modular ones rely on the flat classpath and convention.
module-info.java is the descriptor of a Java module. It declares dependencies, exported packages and services, and enforces strong encapsulation.
Create a Java module with module-info.java, export a package, compile with javac and run it from the module path. Works on Java 9 through 25.
The Java Module System groups packages into modules with explicit dependencies and strong encapsulation. Learn module-info.java, exports vs opens, services and jlink.
JNA calls native shared libraries from Java through a plain interface, with no JNI glue code. See setup, a working C example, type mapping and alternatives.
JNA lets Java call C libraries through plain interfaces, with no JNI code. See setup, type mapping, structures, callbacks and how it compares with JNI and the FFM API.
Optional makes absent values explicit in method signatures and replaces nested null checks with clear chains. Learn how to use it well and where to avoid it.
Learn to use Java Optional to replace null checks: creation, map, flatMap, orElseGet, orElseThrow, ifPresentOrElse and where Optional should not be used.
Optional is a Java 8 container for a value that may be missing. Learn its factory methods, safe ways to read it, chaining, and where not to use it.
Stream.reduce folds a collection into one value. See the three overloads, identity rules, parallel pitfalls and better alternatives such as sum() and collect().
Java's Comparator interface defines custom orderings for sorting and sorted collections. Learn the factory methods, chaining and common pitfalls.
Use list.sort, Collections.sort or streams to sort Java lists in natural, reverse or custom order, and avoid common sorting exceptions.