Deck 17: Swing I

Full screen (f)
exit full mode
Question
The JFrame method setVisible()takes one argument of type:
(a)byte
(b)boolean
(c)int
(d)short
Use Space or
up arrow
down arrow
to flip the card.
Question
A button component should have a registered _____________ associated with it.
(a)pixel
(b)JFrame
(c)listener
(d)none of the above
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
Standard layout managers are defined in the ____________ package.
(a)javax.swing
(b)java.util
(c)java.awt
(d)java.lang
Question
A _____________ allows multiple lines of text to be displayed.
(a)JTextField
(b)JTextArea
(c)JTextBox
(d)JTextValue
Question
The getText()method of a JTextField object returns an object of type:
(a)Double
(b)Integer
(c)Boolean
(d)String
Question
Composition 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 ActionListener interface requires that the method ____________ be implemented.
(a)actionEvent()
(b)actionFired()
(c)actionRegistered()
(d)actionPerformed()
Question
The event-driven paradigm requires implementing methods that will never be invoked.
Question
A button fires events know as:
(a)static events
(b)passive events
(c)dynamic events
(d)action events
Question
Inheritance indicates a/an ____________ relationship.
(a)Is-a
(b)Has-a
(c)both A & B
(d)none of the above
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
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
A ____________ is the smallest unit of space on which your screen can write.
(a)pixel
(b)dot
(c)bit
(d)font
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
GUIs are windowing interfaces that handle user input and output.
Question
A menu item is an object of the class:
(a)JMenu
(b)JMenuBar
(c)JMenuItem
(d)none of the above
Question
The _____________ manager places components into five regions.
(a)BorderLayout
(b)FlowLayout
(c)GridLayout
(d)AbsoluteLayout
Question
What is an action listener? What is an action event?
Question
What are three common objects you must deal with when using a Swing container class?
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
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
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
A Swing program does not end until it encounters a System.exit statement.
Question
One of the main functions of JPanel objects is to subdivide a JFrame (or other container)into different areas.
Question
In a Swing program,throwing an uncaught exception may leave the program in an unpredictable state.
Question
The actionPerformed method of the ActionListener interface returns a Boolean value.
Question
Explain the model-view-controller pattern when applied to a typical GUI.
Question
Events and listeners for menu items are handled in exactly the same way as they are for buttons.
Question
When using the BorderLayout manager you must specify all five regions.
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 a Java statement to create a menu with the title "Drawing Template".
Question
Write Java statements to add the menu created in number 7 above to the menu bar.
Question
A JMenu can not be a menu item in another menu.
Question
Write Java statements to add menu items named "Circle","Square",and "Rectangle" to the menu created in number 7 above.
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 JFrame method setVisible()takes one argument of type:
(a)byte
(b)boolean
(c)int
(d)short
B
2
A button component should have a registered _____________ associated with it.
(a)pixel
(b)JFrame
(c)listener
(d)none of the above
C
3
The _______________ manager arranges components in a two-dimensional table with some number of rows and columns.
(a)BorderLayout
(b)FlowLayout
(c)GridLayout
(d)AbsoluteLayout
C
4
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
5
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
6
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
7
Composition 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
8
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
9
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
10
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
11
A button fires events know as:
(a)static events
(b)passive events
(c)dynamic events
(d)action events
Unlock Deck
Unlock for access to all 37 flashcards in this deck.
Unlock Deck
k this deck
12
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
13
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
14
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
15
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
16
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
17
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
18
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
19
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
20
The _____________ manager places components into five regions.
(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
21
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
22
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
23
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
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
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
26
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
27
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
28
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
29
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
30
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
31
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
32
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
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 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
35
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
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
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
locked card icon
Unlock Deck
Unlock for access to all 37 flashcards in this deck.