GUI2 Flashcards
What is an event in JavaFX?
An event occurs when a user interacts with the application, such as clicking a button or moving the mouse.
What is the default style sheet for JavaFX applications?
The default style sheet is modena.css, located in the jfxrt.jar file.
How can you extract the modena.css file from the JAR file?
Use the command: jar xf jfxrt.jar com/sun/javafx/scene/control/skin/modena/modena.css
What does a style sheet in JavaFX control?
It controls the look of user interface elements.
True or False: JavaFX CSS is based on the W3C CSS version 2.1 specification.
True
List some layout panes provided by the JavaFX SDK.
- BorderPane
- HBox
- VBox
- StackPane
- GridPane
- FlowPane
- TilePane
- AnchorPane
What is an EventHandler in JavaFX?
An EventHandler contains application logic to process an event.
What are the two broad classifications of events in JavaFX?
- Foreground Events
- Background Events
What is the base class for an event in JavaFX?
The class named Event in the javafx.event package.
What type of event is represented by the class MouseEvent?
Mouse input events such as mouse clicked, mouse pressed, mouse released.
What does the KeyEvent class represent?
It indicates the key stroke occurred on a node.
Fill in the blank: The event handling mechanism in JavaFX controls the event and decides what should happen when an event occurs, and the code that is executed is known as an _______.
[event handler]
What are the phases of event handling in JavaFX?
- Route Construction
- Event Capturing Phase
- Event Bubbling Phase
Describe the Event Capturing Phase.
The event travels from the root node down to the target node, executing any registered filters.
Describe the Event Bubbling Phase.
The event travels from the target node back up to the root node, executing any registered handlers.