Deck 17: Swing I

Full screen (f)
exit full mode
Question
The _____________ manager places components into five regions.

A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
Use Space or
up arrow
down arrow
to flip the card.
Question
Composition indicates a/an _______________ relationship.

A)Is-a
B)Has-a
C)both A & B
D)none of the above
Question
A button fires events know as:

A)static events
B)passive events
C)dynamic events
D)action events
Question
A _____________ is an object that is a simple container class that groups other objects.

A)JPanel
B)JMenu
C)JButton
D)JTextArea
Question
The close-window button is in the class JButton.
Question
The _______________ manager arranges components in a two-dimensional table with some number of rows and columns.

A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
Question
A menu item is an object of the class:

A)JMenu
B)JMenuBar
C)JMenuItem
D)none of the above
Question
A _____________ allows multiple lines of text to be displayed.

A)JTextField
B)JTextArea
C)JTextBox
D)JTextValue
Question
A button component should have a registered _____________ associated with it.

A)pixel
B)JFrame
C)listener
D)none of the above
Question
GUIs are windowing interfaces that handle user input and output.
Question
The ActionListener interface requires that the method ____________ be implemented.

A)actionEvent)
B)actionFired)
C)actionRegistered)
D)actionPerformed)
Question
A ____________ is the smallest unit of space on which your screen can write.

A)pixel
B)dot
C)bit
D)font
Question
Inheritance indicates a/an ____________ relationship.

A)Is-a
B)Has-a
C)both A & B
D)none of the above
Question
In event-driven programming,your program determines the order in which things happen.
Question
The getText)method of a JTextField object returns an object of type:

A)Double
B)Integer
C)Boolean
D)String
Question
A programming style that uses a signal and response approach to programming is called:

A)Object Oriented Programming
B)Structured Programming
C)Event-driven Programming
D)Bottom-up Programming
Question
Standard layout managers are defined in the ____________ package.

A)javax.swing
B)java.util
C)java.awt
D)java.lang
Question
The JFrame method setVisible)takes one argument of type:

A)byte
B)boolean
C)int
D)short
Question
The _____________ manager is the simplest layout manager.It arranges components one after the other,going from left to right,in the order in which you add them.

A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
Question
The event-driven paradigm requires implementing methods that will never be invoked.
Question
Create a Java GUI that allows the user to enter a desired user name and password.Provide a button,when clicked,informs the user that their account was successfully created.Include labels as appropriate.
Question
What is an action listener? What is an action event?
Question
One of the main functions of JPanel objects is to subdivide a JFrame or other container)into different areas.
Question
Create a Java GUI application that contains a label and a button.The label reads "Click the button to change the background color." When the button is clicked,the background is changed to a different color.
Question
In a Swing program,throwing an uncaught exception may leave the program in an unpredictable state.
Question
What are three common objects you must deal with when using a Swing container class?
Question
Events and listeners for menu items are handled in exactly the same way as they are for buttons.
Question
Write a Java statement to create a menu with the title "Drawing Template".
Question
Add button functionality to the resulting GUI of number 2 above.When the button is clicked,the title of the window changes to "Modified First Window".
Question
The actionPerformed method of the ActionListener interface returns a Boolean value.
Question
A Swing program does not end until it encounters a System.exit statement.
Question
Write Java statements to add the menu created in number 7 above to the menu bar.
Question
Write a Java statement to add a title to the window in the GUI created in number 1 above that says "First Window".
Question
Write Java statements to add menu items named "Circle","Square",and "Rectangle" to the menu created in number 7 above.
Question
Explain the model-view-controller pattern when applied to a typical GUI.
Question
A JMenu can not be a menu item in another menu.
Question
When using the BorderLayout manager you must specify all five regions.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/37
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 17: Swing I
1
The _____________ manager places components into five regions.

A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
A
2
Composition indicates a/an _______________ relationship.

A)Is-a
B)Has-a
C)both A & B
D)none of the above
B
3
A button fires events know as:

A)static events
B)passive events
C)dynamic events
D)action events
D
4
A _____________ is an object that is a simple container class that groups other objects.

A)JPanel
B)JMenu
C)JButton
D)JTextArea
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
5
The close-window button is in the class JButton.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
6
The _______________ manager arranges components in a two-dimensional table with some number of rows and columns.

A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
7
A menu item is an object of the class:

A)JMenu
B)JMenuBar
C)JMenuItem
D)none of the above
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
8
A _____________ allows multiple lines of text to be displayed.

A)JTextField
B)JTextArea
C)JTextBox
D)JTextValue
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
9
A button component should have a registered _____________ associated with it.

A)pixel
B)JFrame
C)listener
D)none of the above
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
10
GUIs are windowing interfaces that handle user input and output.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
11
The ActionListener interface requires that the method ____________ be implemented.

A)actionEvent)
B)actionFired)
C)actionRegistered)
D)actionPerformed)
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
12
A ____________ is the smallest unit of space on which your screen can write.

A)pixel
B)dot
C)bit
D)font
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
13
Inheritance indicates a/an ____________ relationship.

A)Is-a
B)Has-a
C)both A & B
D)none of the above
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
14
In event-driven programming,your program determines the order in which things happen.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
15
The getText)method of a JTextField object returns an object of type:

A)Double
B)Integer
C)Boolean
D)String
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
16
A programming style that uses a signal and response approach to programming is called:

A)Object Oriented Programming
B)Structured Programming
C)Event-driven Programming
D)Bottom-up Programming
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
17
Standard layout managers are defined in the ____________ package.

A)javax.swing
B)java.util
C)java.awt
D)java.lang
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
18
The JFrame method setVisible)takes one argument of type:

A)byte
B)boolean
C)int
D)short
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
19
The _____________ manager is the simplest layout manager.It arranges components one after the other,going from left to right,in the order in which you add them.

A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
20
The event-driven paradigm requires implementing methods that will never be invoked.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
21
Create a Java GUI that allows the user to enter a desired user name and password.Provide a button,when clicked,informs the user that their account was successfully created.Include labels as appropriate.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
22
What is an action listener? What is an action event?
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
23
One of the main functions of JPanel objects is to subdivide a JFrame or other container)into different areas.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
24
Create a Java GUI application that contains a label and a button.The label reads "Click the button to change the background color." When the button is clicked,the background is changed to a different color.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
25
In a Swing program,throwing an uncaught exception may leave the program in an unpredictable state.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
26
What are three common objects you must deal with when using a Swing container class?
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
27
Events and listeners for menu items are handled in exactly the same way as they are for buttons.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
28
Write a Java statement to create a menu with the title "Drawing Template".
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
29
Add button functionality to the resulting GUI of number 2 above.When the button is clicked,the title of the window changes to "Modified First Window".
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
30
The actionPerformed method of the ActionListener interface returns a Boolean value.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
31
A Swing program does not end until it encounters a System.exit statement.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
32
Write Java statements to add the menu created in number 7 above to the menu bar.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
33
Write a Java statement to add a title to the window in the GUI created in number 1 above that says "First Window".
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
34
Write Java statements to add menu items named "Circle","Square",and "Rectangle" to the menu created in number 7 above.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
35
Explain the model-view-controller pattern when applied to a typical GUI.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
36
A JMenu can not be a menu item in another menu.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
37
When using the BorderLayout manager you must specify all five regions.
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 37 flashcards in this deck.