GUI2 Flashcards

1
Q

What is an event in JavaFX?

A

An event occurs when a user interacts with the application, such as clicking a button or moving the mouse.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the default style sheet for JavaFX applications?

A

The default style sheet is modena.css, located in the jfxrt.jar file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you extract the modena.css file from the JAR file?

A

Use the command: jar xf jfxrt.jar com/sun/javafx/scene/control/skin/modena/modena.css

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does a style sheet in JavaFX control?

A

It controls the look of user interface elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or False: JavaFX CSS is based on the W3C CSS version 2.1 specification.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List some layout panes provided by the JavaFX SDK.

A
  • BorderPane
  • HBox
  • VBox
  • StackPane
  • GridPane
  • FlowPane
  • TilePane
  • AnchorPane
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an EventHandler in JavaFX?

A

An EventHandler contains application logic to process an event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the two broad classifications of events in JavaFX?

A
  • Foreground Events
  • Background Events
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the base class for an event in JavaFX?

A

The class named Event in the javafx.event package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What type of event is represented by the class MouseEvent?

A

Mouse input events such as mouse clicked, mouse pressed, mouse released.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the KeyEvent class represent?

A

It indicates the key stroke occurred on a node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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 _______.

A

[event handler]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the phases of event handling in JavaFX?

A
  • Route Construction
  • Event Capturing Phase
  • Event Bubbling Phase
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe the Event Capturing Phase.

A

The event travels from the root node down to the target node, executing any registered filters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Describe the Event Bubbling Phase.

A

The event travels from the target node back up to the root node, executing any registered handlers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of the Scene in a JavaFX application?

A

It holds all the physical contents (nodes) of the application.

17
Q

What is the structure of a JavaFX application?

A

It consists of three main components: Stage, Scene, and nodes.

18
Q

What class must be imported to create a JavaFX application?

A

javafx.application.Application

19
Q

What method must be overridden to start a JavaFX application?

A

The start() method.

20
Q

What is the role of the Stage in a JavaFX application?

A

It acts as a container for all JavaFX objects.

21
Q

True or False: The primary stage in a JavaFX application is created by the application itself.

A

False

22
Q

What is FXML in JavaFX?

A

FXML is an XML vocabulary for defining and arranging JavaFX GUI controls without writing Java code.

23
Q

What does JavaFX Scene Builder allow you to do?

A

Create GUIs by dragging and dropping GUI components.

24
Q

Fill in the blank: JavaFX enables you to change the look-and-feel of your GUI using _______.

A

[Cascading Style Sheets (CSS)]

25
Q

What is the primary purpose of creating style sheets in JavaFX?

A

To override the styles in the default style sheet and to add custom styles.

26
Q

What is the first step in creating a JavaFX application?

A

Extend the Application class and override the start() method.

27
Q

What happens when the show() method is called on the primary stage object?

A

It displays the primary stage.

28
Q

What is the significance of the root node in the scene graph?

A

It acts as a parent node for all other nodes present in the scene graph.

29
Q

What are leaf nodes in the context of a scene graph?

A

Nodes that exist at the lowest level in the tree hierarchy.

30
Q

True or False: You need to know FXML or XML to study JavaFX.

A

False