Deck 11: Java-Fx: Gui Programming and Basic Controls

ملء الشاشة (f)
exit full mode
سؤال
An event handler class will not be executed unless it has been registered with the correct control.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
One important difference between the command line interface and a GUI interface is that

A) in command line the background color of the monitor will always be black but in a GUI it can be any color
B) in a GUI environment the user determines the order in which things happen while the user has no control over the order or events in a command line interface
C) users must type information in a command line interface but, when using a GUI, typing is never required
D) All of these are important differences.
سؤال
The BorderPane container always displays its content in five regions which are top, bottom, left, right, and center and each region must be used.
سؤال
To display an image in a JavaFX application you must

A) include either the Image or the ImageView class
B) include both the setImage and the ViewImage classes
C) include both the Image and the ImageView classes
D) include either the setImage or the ViewImage class
سؤال
The command line interface is an event-driven interface.
سؤال
In order to leave 15 pixels of space in an HBox container, use which of the following statements?

A) myhbox = setPadding(15);
B) myhbox.setPadding(15);
C) myhbox.setPadding.Insets(15);
D) myhbox.setPadding(new Insets(15));
سؤال
To display an image in a JavaFX application, you use either the Image or ImageView class.
سؤال
The Application class's __________ method is the main entry point for a JavaFX application.

A) start
B) init
C) addWindow
D) mainFX
سؤال
The "preferred size" of a scene is usually the whole size of the user's monitor.
سؤال
The foundation of a GUI application is the

A) Stage object
B) start method
C) Application class
D) Scene object
سؤال
When programming in JavaFX, you should think of the GUI objects as nodes in a tree-like hierarchical structure known as a scene graph.
سؤال
The __________ layout container arranges the contents into cells, similar to a spreadsheet.

A) GRID
B) GridPane
C) GridPaneObj
D) CellPane
سؤال
Which of the following is not a way a user can interact with a computer?

A) command line
B) console interface
C) GUI
D) All of these are ways a user can interact with a computer.
سؤال
An event object is created when an event takes place.
سؤال
Padding is space that appears around the inside edges of a container.
سؤال
To change the alignment of an HBox you call the

A) setAlignment method
B) Alignment method
C) PreferredSize method
D) Pos method
سؤال
In a JavaFX application, you are limited to a single layout container since layout containers cannot be nested.
سؤال
All JavaFX applicatons must extend the Application class.
سؤال
In order to preserve an image's aspect ratio (so it does not appear stretched or distorted), you should use which of the following? Assume myView references an ImageView object.

A) myView.setPreserveRatio(false);
B) myView.setPreserveRatio(true);
C) myView.setPreserveRatio();
D) Either (a) or (c) would work.
سؤال
In memory, GUI objects in a __________ are organized as __________ in a tree-like hierarchical data structure.

A) node, scenes
B) scene graph, nodes
C) scene, nodes
D) scene graph, methods
سؤال
Which of the following import statements is required in order to create a BorderPane layout container?

A) import javafx.scene.layout.Box;
B) import javafx.scene.layout;
C) import javafx.layout.scene.BorderPane;
D) import javafx.scene.layout.BorderPane;
سؤال
Select all that apply. Which of the following are regions where content can be displayed in the BorderPane layout container?

A) top and bottom
B) center
C) above and below center
D) left and right
سؤال
To create a TextField control, you use the __________ class which is in the __________ package.

A) TextField, javafx.text.control
B) TextField, javafx.scene.control
C) TextBox, javafx.scene.control
D) TextField, javafx.textfield
سؤال
Select all that apply. Which of the following are operations that can be performed by the launch method?

A) creating a Stage object
B) calling the start method
C) calling the Application constructor
D) calling an event handler
سؤال
Select all that apply. Given the statement shown below, which of the following statements are true? Scene scene = new Scene(hbox, 100, 500);

A) The width of the scene will be 100 pixels.
B) The height of the scene will be 100 pixels.
C) A Scene object named scene will be created.
D) The root node is hbox.
سؤال
Select all that apply. Which of the following are constructors of the BorderPane class?

A) BorderPane()
B) BorderPane(top, bottom)
C) BorderPane(center)
D) BorderPane(left, right)
E) BorderPane(center, top, right, bottom, left)
سؤال
Select all that apply. Which of the following file types are supported by the Image class?

A) BMP
B) JPEG
C) GIF
D) PNG
سؤال
Which of the following statements correctly adds a label to the first row and second column of a GridPane object?

A) gridpane.add(myLabel, 1, 2);
B) gridpane.add(myLabel, 2, 1);
C) gridpane.add(myLabel, 0, 1);
D) gridpane.add(myLabel, 1, 0);
سؤال
Assuming three ImageView objects named puppy, kitten, and bunny have been created, what does the following statement do? HBox hbox = new HBox(5, puppy, kitten, bunny);

A) The number 5 refers to the number of ImageView objects so there will be two empty spots for two more ImageView objects.
B) There will be five pixels of space between the controls horizontally in the container.
C) The controls will be displayed vertically with five pixels between them.
D) The statement does nothing; it contains an error.
سؤال
The process of connecting an event handler object to a control is called __________ the event handler.

A) passing
B) registering
C) applying
D) rendering
سؤال
Which of the following import statements is required in order to write an event handler class?

A) import javafx.event.EventHandler;
B) import javafx.event.ActionEvent;
C) import javafx.EventHandler;
D) import javafx.EventHandler.event;
سؤال
If you set a scene's size to a width and height that is smaller than the width and height of the image to be displayed,

A) only part of the image will be displayed
B) the image will only occupy part of the window
C) the scene will automatically be resized to fit the image
D) the image will automatically be resized to fit the window
سؤال
An action that takes place while a program is running is a(n)

A) event source
B) event handler
C) event
D) event object
سؤال
Select all that apply. Which of the following nodes are allowed in a scene graph?

A) Root
B) Button
C) Leaf
D) Branch
سؤال
If a BorderPane region does not contain anything,

A) the region will appear gray by default
B) the region will not appear in the GUI
C) an error will occur
D) content from an adjacent region will be duplicated to appear in the empty region
سؤال
Which package contains the Insets class?

A) javafx.scene
B) javafx.layout
C) javafx.Insets
D) javafx.geometry
سؤال
What does the following statement do? Image puppy = new Image("file:C:\\images\terrier.j p g ");

A) It creates an instance of the ImageView class with the terrier. J p g file passed to the constructor.
B) It loads an image named "images\terrier.j p g " and stores the image in the Image variable.
C) It loads an image file named terrier. j p g which is found in the images folder on the user's C-drive.
D) Nothing; it is not possible to include a path to a file when using the Image class.
سؤال
When an event takes place, the control responsible for the event creates an event __________.

A) source
B) object
C) handler
D) firing
سؤال
To retrieve text that a user has typed into a TextField control, you call the __________ method.

A) inputText
B) getInput
C) getText
D) getInputText
سؤال
What method do you call to register an event handler with a Button control?

A) setAction
B) onClickAction
C) setOnClick
D) setOnAction
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 11: Java-Fx: Gui Programming and Basic Controls
1
An event handler class will not be executed unless it has been registered with the correct control.
True
2
One important difference between the command line interface and a GUI interface is that

A) in command line the background color of the monitor will always be black but in a GUI it can be any color
B) in a GUI environment the user determines the order in which things happen while the user has no control over the order or events in a command line interface
C) users must type information in a command line interface but, when using a GUI, typing is never required
D) All of these are important differences.
B
3
The BorderPane container always displays its content in five regions which are top, bottom, left, right, and center and each region must be used.
False
4
To display an image in a JavaFX application you must

A) include either the Image or the ImageView class
B) include both the setImage and the ViewImage classes
C) include both the Image and the ImageView classes
D) include either the setImage or the ViewImage class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
5
The command line interface is an event-driven interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
6
In order to leave 15 pixels of space in an HBox container, use which of the following statements?

A) myhbox = setPadding(15);
B) myhbox.setPadding(15);
C) myhbox.setPadding.Insets(15);
D) myhbox.setPadding(new Insets(15));
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
7
To display an image in a JavaFX application, you use either the Image or ImageView class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
8
The Application class's __________ method is the main entry point for a JavaFX application.

A) start
B) init
C) addWindow
D) mainFX
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
9
The "preferred size" of a scene is usually the whole size of the user's monitor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
10
The foundation of a GUI application is the

A) Stage object
B) start method
C) Application class
D) Scene object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
11
When programming in JavaFX, you should think of the GUI objects as nodes in a tree-like hierarchical structure known as a scene graph.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
12
The __________ layout container arranges the contents into cells, similar to a spreadsheet.

A) GRID
B) GridPane
C) GridPaneObj
D) CellPane
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
13
Which of the following is not a way a user can interact with a computer?

A) command line
B) console interface
C) GUI
D) All of these are ways a user can interact with a computer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
14
An event object is created when an event takes place.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
15
Padding is space that appears around the inside edges of a container.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
16
To change the alignment of an HBox you call the

A) setAlignment method
B) Alignment method
C) PreferredSize method
D) Pos method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
17
In a JavaFX application, you are limited to a single layout container since layout containers cannot be nested.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
18
All JavaFX applicatons must extend the Application class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
19
In order to preserve an image's aspect ratio (so it does not appear stretched or distorted), you should use which of the following? Assume myView references an ImageView object.

A) myView.setPreserveRatio(false);
B) myView.setPreserveRatio(true);
C) myView.setPreserveRatio();
D) Either (a) or (c) would work.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
20
In memory, GUI objects in a __________ are organized as __________ in a tree-like hierarchical data structure.

A) node, scenes
B) scene graph, nodes
C) scene, nodes
D) scene graph, methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following import statements is required in order to create a BorderPane layout container?

A) import javafx.scene.layout.Box;
B) import javafx.scene.layout;
C) import javafx.layout.scene.BorderPane;
D) import javafx.scene.layout.BorderPane;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
22
Select all that apply. Which of the following are regions where content can be displayed in the BorderPane layout container?

A) top and bottom
B) center
C) above and below center
D) left and right
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
23
To create a TextField control, you use the __________ class which is in the __________ package.

A) TextField, javafx.text.control
B) TextField, javafx.scene.control
C) TextBox, javafx.scene.control
D) TextField, javafx.textfield
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
24
Select all that apply. Which of the following are operations that can be performed by the launch method?

A) creating a Stage object
B) calling the start method
C) calling the Application constructor
D) calling an event handler
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
25
Select all that apply. Given the statement shown below, which of the following statements are true? Scene scene = new Scene(hbox, 100, 500);

A) The width of the scene will be 100 pixels.
B) The height of the scene will be 100 pixels.
C) A Scene object named scene will be created.
D) The root node is hbox.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
26
Select all that apply. Which of the following are constructors of the BorderPane class?

A) BorderPane()
B) BorderPane(top, bottom)
C) BorderPane(center)
D) BorderPane(left, right)
E) BorderPane(center, top, right, bottom, left)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
27
Select all that apply. Which of the following file types are supported by the Image class?

A) BMP
B) JPEG
C) GIF
D) PNG
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which of the following statements correctly adds a label to the first row and second column of a GridPane object?

A) gridpane.add(myLabel, 1, 2);
B) gridpane.add(myLabel, 2, 1);
C) gridpane.add(myLabel, 0, 1);
D) gridpane.add(myLabel, 1, 0);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
29
Assuming three ImageView objects named puppy, kitten, and bunny have been created, what does the following statement do? HBox hbox = new HBox(5, puppy, kitten, bunny);

A) The number 5 refers to the number of ImageView objects so there will be two empty spots for two more ImageView objects.
B) There will be five pixels of space between the controls horizontally in the container.
C) The controls will be displayed vertically with five pixels between them.
D) The statement does nothing; it contains an error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
30
The process of connecting an event handler object to a control is called __________ the event handler.

A) passing
B) registering
C) applying
D) rendering
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following import statements is required in order to write an event handler class?

A) import javafx.event.EventHandler;
B) import javafx.event.ActionEvent;
C) import javafx.EventHandler;
D) import javafx.EventHandler.event;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
32
If you set a scene's size to a width and height that is smaller than the width and height of the image to be displayed,

A) only part of the image will be displayed
B) the image will only occupy part of the window
C) the scene will automatically be resized to fit the image
D) the image will automatically be resized to fit the window
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
33
An action that takes place while a program is running is a(n)

A) event source
B) event handler
C) event
D) event object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
34
Select all that apply. Which of the following nodes are allowed in a scene graph?

A) Root
B) Button
C) Leaf
D) Branch
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
35
If a BorderPane region does not contain anything,

A) the region will appear gray by default
B) the region will not appear in the GUI
C) an error will occur
D) content from an adjacent region will be duplicated to appear in the empty region
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which package contains the Insets class?

A) javafx.scene
B) javafx.layout
C) javafx.Insets
D) javafx.geometry
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
37
What does the following statement do? Image puppy = new Image("file:C:\\images\terrier.j p g ");

A) It creates an instance of the ImageView class with the terrier. J p g file passed to the constructor.
B) It loads an image named "images\terrier.j p g " and stores the image in the Image variable.
C) It loads an image file named terrier. j p g which is found in the images folder on the user's C-drive.
D) Nothing; it is not possible to include a path to a file when using the Image class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
38
When an event takes place, the control responsible for the event creates an event __________.

A) source
B) object
C) handler
D) firing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
39
To retrieve text that a user has typed into a TextField control, you call the __________ method.

A) inputText
B) getInput
C) getText
D) getInputText
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
40
What method do you call to register an event handler with a Button control?

A) setAction
B) onClickAction
C) setOnClick
D) setOnAction
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.