Deck 17: Swing I
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/37
Play
Full screen (f)
Deck 17: Swing I
1
The JFrame method setVisible()takes one argument of type:
(a)byte
(b)boolean
(c)int
(d)short
(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
(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
(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
(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
(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
(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
(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()
(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
(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
(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
(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
(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
(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
(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
(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
(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