Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dtonhofer/javafx_button_exercise
A simple exercise in trying to understand the events generated by a JavaFX button
https://github.com/dtonhofer/javafx_button_exercise
educational example-code javafx javafx-maven-plugin
Last synced: about 1 month ago
JSON representation
A simple exercise in trying to understand the events generated by a JavaFX button
- Host: GitHub
- URL: https://github.com/dtonhofer/javafx_button_exercise
- Owner: dtonhofer
- License: unlicense
- Created: 2024-10-08T06:42:47.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-10T16:26:26.000Z (3 months ago)
- Last Synced: 2024-11-30T08:43:42.972Z (about 1 month ago)
- Topics: educational, example-code, javafx, javafx-maven-plugin
- Language: Java
- Homepage:
- Size: 439 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# javafx_button_exercise
A simple exercise in trying to understand the sequence of events generated by a JavaFX button.
I posted the question
[JavaFX events sent to a button control: why two MOUSE_ENTERED / MOUSE_EXITED events?](https://stackoverflow.com/questions/79059318/javafx-events-sent-to-a-button-control-why-two-mouse-entered-mouse-exited-eve/)
to Stack Overflow, and after clarification, we get the code and diagrams in this project.
The program creates a [Button Control](https://openjfx.io/javadoc/23/javafx.controls/javafx/scene/control/Button.html) which you can prod.
![Button Control statechart](doc/button.png)
Information about events generated by the Button Control (aka. "received at the Button Control's event handlers) is then printed out.
See the [`MouseEvent` JavaDoc](https://openjfx.io/javadoc/23/javafx.graphics/javafx/scene/input/MouseEvent.html) for a description of events.
After testing a bit, we obtain the following (not quite formally correct) [statechart](https://en.wikipedia.org/wiki/UML_state_machine)
that describes what events are generated. The statechart is large-ish because the sequence of event generated depends on where exactly
the mouse button was pressed - outside the Button Control, inside the Button Control or inside the Button Control's label.
(But there may well be a simpler statechart.)![Button Control statechart](doc/Button%20state%20machine.png)
The above has been edited in yEd, which has no notion about statechart semantics. The result is a [graphml file](doc/Button%20state%20machine.graphml).