Deck 15: Graphics and Java 2d
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/15
Play
Full screen (f)
Deck 15: Graphics and Java 2d
1
Which of the following properly create and initialize a Font object? A.Font f = new Font();
B)Font f = new Font( "Serif",Font.Bold + Font.Italic,19 );
C)Font f = new Font( Font.Bold,20,"SansSerif" );
D)Font f = new Font( 20,Font.Bold,"Monospaced" );
A)A and B.
B)B and C.
C)B.
D)D.
B)Font f = new Font( "Serif",Font.Bold + Font.Italic,19 );
C)Font f = new Font( Font.Bold,20,"SansSerif" );
D)Font f = new Font( 20,Font.Bold,"Monospaced" );
A)A and B.
B)B and C.
C)B.
D)D.
C
2
Which of the following statements about the Graphics object is true? A.The Graphics object is an argument to class Component's repaint method.
B)The Graphics object is instantiated by the user.
C)The Graphics object is the argument to a lightweight GUI component's paintComponent method.
D)The Graphics class is abstract.
E)The Graphics object manages a graphics context.
A)A,C,E.
B)C,D,E.
C)A,B,D,E.
D)All are true.
B)The Graphics object is instantiated by the user.
C)The Graphics object is the argument to a lightweight GUI component's paintComponent method.
D)The Graphics class is abstract.
E)The Graphics object manages a graphics context.
A)A,C,E.
B)C,D,E.
C)A,B,D,E.
D)All are true.
B
3
Method getFont of class Graphics returns:
A)the current font name as a string.
B)the font size in points.
C)a Graphics object representing the current font.
D)a Font object representing the current font.
A)the current font name as a string.
B)the font size in points.
C)a Graphics object representing the current font.
D)a Font object representing the current font.
D
4
Class FontMetrics declares methods that can be used to obtain the following font metrics:
A)ascent,descent and height.
B)ascent,descent and leading.
C)height and leading.
D)All of the above.
A)ascent,descent and height.
B)ascent,descent and leading.
C)height and leading.
D)All of the above.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following statements about arcs is false?
A)An arc is drawn as a part of an oval.
B)Arcs sweep from a starting angle the number of degrees specified by their arc angle.
C)Arcs that sweep clockwise are measured in positive degrees.
D)None of the above statements are false.
A)An arc is drawn as a part of an oval.
B)Arcs sweep from a starting angle the number of degrees specified by their arc angle.
C)Arcs that sweep clockwise are measured in positive degrees.
D)None of the above statements are false.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following statements is false?
A)A BufferedImage object uses the image stored in its associated TexturePaint object as the fill texture for a filled-in shape.
B)Class BufferedImage can be used to produce images in color and gray scale.
C)Class GradientPath draws a shape in a gradually changing color.
D)All of the above are true.
A)A BufferedImage object uses the image stored in its associated TexturePaint object as the fill texture for a filled-in shape.
B)Class BufferedImage can be used to produce images in color and gray scale.
C)Class GradientPath draws a shape in a gradually changing color.
D)All of the above are true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
7
The Graphics2D method(s)that determine(s)the color and texture for the shape to display is/are:
A)setStroke
B)setPaint
C)setTexture and setColor
D)setTexturePaint
A)setStroke
B)setPaint
C)setTexture and setColor
D)setTexturePaint
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
8
The JColorChooser dialog allows colors to be chosen by all but which of the following?
A)Swatches.
B)Hue,saturation,brightness.
C)Gradient,cycle,brightness.
D)Red,Green,Blue.
A)Swatches.
B)Hue,saturation,brightness.
C)Gradient,cycle,brightness.
D)Red,Green,Blue.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
9
A general path is:
A)a set of polylines that do not result in a closed shape.
B)a shape constructed from straight lines and complex curves.
C)the shape of the curve in a font's characters.
D)represented by an object of class GraphicsPath.
A)a set of polylines that do not result in a closed shape.
B)a shape constructed from straight lines and complex curves.
C)the shape of the curve in a font's characters.
D)represented by an object of class GraphicsPath.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following statements about the Java 2D API is true?
A)A Graphics2D object is instantiated to draw Java 2D figures.
B)Class Graphics2D is a subclass of class Graphics.
C)To access Graphics2D capabilities,cast the Graphics reference passed to paintComponent to a Graphics2D reference.
D)All of the above are true.
A)A Graphics2D object is instantiated to draw Java 2D figures.
B)Class Graphics2D is a subclass of class Graphics.
C)To access Graphics2D capabilities,cast the Graphics reference passed to paintComponent to a Graphics2D reference.
D)All of the above are true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
11
Consider the Java code segment below: Polygon poly2 = new Polygon();
Poly2.addPoint( 100,30 );
Poly2.addPoint( 100,130 );
Which of the following will create a polygon that is a square?
A)poly2.addPoint( 100,60 ); poly2.addPoint( 100,130 );
B)poly2.addPoint( 200,130 ); poly2.addPoint( 200,30 );
C)poly2.addPoint( 200,60 ); poly2.addPoint( 200,130 );
D)poly2.addPoint( 100,130 ); poly2.addPoint( 100,230 );
Poly2.addPoint( 100,30 );
Poly2.addPoint( 100,130 );
Which of the following will create a polygon that is a square?
A)poly2.addPoint( 100,60 ); poly2.addPoint( 100,130 );
B)poly2.addPoint( 200,130 ); poly2.addPoint( 200,30 );
C)poly2.addPoint( 200,60 ); poly2.addPoint( 200,130 );
D)poly2.addPoint( 100,130 ); poly2.addPoint( 100,230 );
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
12
The fact that class Graphics is abstract contributes to Java's portability because:
A)drawing is performed differently on every platform that supports Java.A subclass of Graphics must be created that uses the drawing capabilities of the current platform.
B)objects of non-abstract classes can only be instantiated on the Windows platform.
C)drawing should not be performed on non-Linux platforms.
D)Class Graphics is not abstract.
A)drawing is performed differently on every platform that supports Java.A subclass of Graphics must be created that uses the drawing capabilities of the current platform.
B)objects of non-abstract classes can only be instantiated on the Windows platform.
C)drawing should not be performed on non-Linux platforms.
D)Class Graphics is not abstract.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following is correct for font metrics?
A)height = descent + ascent + leading.
B)The amount the character dips below the baseline is the ascent.
C)The amount the character can be above the baseline is the leading.
D)The amount the character rises above the baseline is the descent.
A)height = descent + ascent + leading.
B)The amount the character dips below the baseline is the ascent.
C)The amount the character can be above the baseline is the leading.
D)The amount the character rises above the baseline is the descent.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
14
GeneralPath method lineTo
A)draws a line from the previous point in the GeneralPath object to the current point.
B)draws a line with an arrow head to point to a GeneralPath object.
C)moves the drawing origin around a line.
D)specifies the first point in a GeneralPath object.
A)draws a line from the previous point in the GeneralPath object to the current point.
B)draws a line with an arrow head to point to a GeneralPath object.
C)moves the drawing origin around a line.
D)specifies the first point in a GeneralPath object.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
15
In the Java coordinate system,the point (0,0)is:
A)The lower-right corner of the screen.
B)The upper-right corner of the screen.
C)The lower-left corner of the screen.
D)The upper-left corner of the screen.
A)The lower-right corner of the screen.
B)The upper-right corner of the screen.
C)The lower-left corner of the screen.
D)The upper-left corner of the screen.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck