Deck 18: Swing II

Full screen (f)
exit full mode
Question
The method paint has one parameter of type:
(a)Shape
(b)Graphics
(c)Image
(d)String
Use Space or
up arrow
down arrow
to flip the card.
Question
Icons can be added to:
(a)JLabels
(b)JButtons
(c)JMenuItems
(d)all of the above
Question
An invocation of the Container class method _____________ updates components on the screen.
(a)setVisible
(b)setLayout
(c)update
(d)validate
Question
Java uses a coordinate system whose origin point (0,0)is located at the upper-left corner of the screen area.
Question
If the policies for scroll bars are never set then the scroll bars will never be visible.
Question
An imaginary _____________ is used for drawing all shapes on the screen.
(a)bounding box
(b)view port
(c)container
(d)none of the above
Question
The Insets class is in the package ______________.
(a)java.awt
(b)javax.swing
(c)java.util
(d)java.lang
Question
When using scroll bars,the text is viewed through a ______________ that shows only part of the text at a time.
(a)view port
(b)text area
(c)all of the above
(d)none of the above
Question
All of the following are methods of the Graphics class except:
(a)drawRect
(b)fillRect
(c)coloredRect
(d)fill3DRect
Question
You can use the Java method ______________ from the Color class to change the drawing color.
(a)changeColor
(b)getColor
(c)setColor
(d)useColor
Question
The Graphics class is a(n)____________ class.
(a)discrete
(b)concrete
(c)abstract
(d)none of the above
Question
A view port shows only part of the text at one time.
Question
All of the following are methods of the class Color except:
(a)getRed
(b)brighter
(c)darker
(d)dimmer
Question
The dispose method of the JFrame class terminates a Java program.
Question
To by pass implementing all methods in the WindowListener interface,make the window listener a derived class of:
(a)WindowEvent
(b)ActionEvent
(c)WindowAdapter
(d)None of the above
Question
A window listener must define all the method headings in the WindowListener interface,even if some are trivial implementations.
Question
Any change to graphics being displayed on the screen requires a call to the method ____________ to update the graphics.
(a)paint
(b)repaint
(c)update
(d)all of the above
Question
The paint method of the Graphics class can only be used with Applets.
Question
The class JFrame has a method named __________ that eliminates the invoking JFrame without terminating the program.
(a)close
(b)dispose
(c)eliminate
(d)None of the above
Question
When the user clicks any of the three standard JFrame buttons,a ___________ is generated.
(a)window listener
(b)window event
(c)window activator
(d)window deactivator
Question
A rounded rectangle is a rectangle whose corners have been replaced by arcs.
Question
Write a Java statement that draws a filled oval at position (150,100)with a height of 100 and a width of 50.
Question
The class JColorChooser can be used to produce a dialog window that allows you to choose a color by looking at color samples.
Question
The Java Color class mixes amounts of red,green and yellow to produce any new color you might want.
Question
Write a Java statement that uses a Graphics object to display "Hello World" at position 50,100.
Question
The drawArc method of the Graphics class requires a starting angle.A positive starting angle indicates a clockwise direction.
Question
Write Java statements to add the icon created in number 1 above to a label that says "Love".
Question
Explain the Java coordinate system for graphic objects.
Question
Write a Java statement to create an image icon for the image heart.gif.
Question
Set policies for the scroll bar created in number 3 above.
Question
Write a Java statement to create a scroll pane for a text area named productDescription.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/31
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 18: Swing II
1
The method paint has one parameter of type:
(a)Shape
(b)Graphics
(c)Image
(d)String
B
2
Icons can be added to:
(a)JLabels
(b)JButtons
(c)JMenuItems
(d)all of the above
D
3
An invocation of the Container class method _____________ updates components on the screen.
(a)setVisible
(b)setLayout
(c)update
(d)validate
D
4
Java uses a coordinate system whose origin point (0,0)is located at the upper-left corner of the screen area.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
5
If the policies for scroll bars are never set then the scroll bars will never be visible.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
6
An imaginary _____________ is used for drawing all shapes on the screen.
(a)bounding box
(b)view port
(c)container
(d)none of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
7
The Insets class is in the package ______________.
(a)java.awt
(b)javax.swing
(c)java.util
(d)java.lang
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
8
When using scroll bars,the text is viewed through a ______________ that shows only part of the text at a time.
(a)view port
(b)text area
(c)all of the above
(d)none of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
9
All of the following are methods of the Graphics class except:
(a)drawRect
(b)fillRect
(c)coloredRect
(d)fill3DRect
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
10
You can use the Java method ______________ from the Color class to change the drawing color.
(a)changeColor
(b)getColor
(c)setColor
(d)useColor
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
11
The Graphics class is a(n)____________ class.
(a)discrete
(b)concrete
(c)abstract
(d)none of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
12
A view port shows only part of the text at one time.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
13
All of the following are methods of the class Color except:
(a)getRed
(b)brighter
(c)darker
(d)dimmer
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
14
The dispose method of the JFrame class terminates a Java program.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
15
To by pass implementing all methods in the WindowListener interface,make the window listener a derived class of:
(a)WindowEvent
(b)ActionEvent
(c)WindowAdapter
(d)None of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
16
A window listener must define all the method headings in the WindowListener interface,even if some are trivial implementations.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
17
Any change to graphics being displayed on the screen requires a call to the method ____________ to update the graphics.
(a)paint
(b)repaint
(c)update
(d)all of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
18
The paint method of the Graphics class can only be used with Applets.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
19
The class JFrame has a method named __________ that eliminates the invoking JFrame without terminating the program.
(a)close
(b)dispose
(c)eliminate
(d)None of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
20
When the user clicks any of the three standard JFrame buttons,a ___________ is generated.
(a)window listener
(b)window event
(c)window activator
(d)window deactivator
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
21
A rounded rectangle is a rectangle whose corners have been replaced by arcs.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
22
Write a Java statement that draws a filled oval at position (150,100)with a height of 100 and a width of 50.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
23
The class JColorChooser can be used to produce a dialog window that allows you to choose a color by looking at color samples.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
24
The Java Color class mixes amounts of red,green and yellow to produce any new color you might want.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
25
Write a Java statement that uses a Graphics object to display "Hello World" at position 50,100.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
26
The drawArc method of the Graphics class requires a starting angle.A positive starting angle indicates a clockwise direction.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
27
Write Java statements to add the icon created in number 1 above to a label that says "Love".
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
28
Explain the Java coordinate system for graphic objects.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
29
Write a Java statement to create an image icon for the image heart.gif.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
30
Set policies for the scroll bar created in number 3 above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
31
Write a Java statement to create a scroll pane for a text area named productDescription.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 31 flashcards in this deck.