Deck 16: Graphics

Full screen (f)
exit full mode
Question
The drawRoundRect() method requires ____ arguments.

A) three
B) four
C) six
D) eight
Use Space or
up arrow
down arrow
to flip the card.
Question
You can instruct a Graphics object to use a font by inserting the font as the argument in a ____ method.

A) setColor()
B) drawString()
C) setCharacters()
D) setFont()
Question
In Java, whether a paint request is triggered by the system or an application, a Component's paint() method is invoked.
Question
The ____ method draws what appears to be an empty rectangle.

A) clearRect()
B) emptyRect()
C) fillRect()
D) drawRect()
Question
The ____ method in the Graphics class allows you to draw a String on a JPanel or other component .

A) drawString()
B) setFont()
C) drawLine()
D) setString()
Question
The statements pen.drawLine(50, 50, 100, 200); and pen.drawLine(100, 200, 50, 50); will both draw straight lines that slant down and to the right.
Question
The drawPolygon() method requires four arguments, two integer arrays, and two single integers.
Question
System-triggered painting occurs when a program requests it, usually because the internal state of a component has changed.
Question
A rectangle created with the clearRect() method is not transparent.
Question
The getScreenSize()  method returns an object of type Pixels , which specifies the width  and height of the screen in pixels.
Question
The FontMetrics class methods return an integer value representing the font size in points, with one point measuring 1/72 of an inch.
Question
If you want to change graphic output on a panel in response to a user's mouse click, you would place a call to ____ in the actionPerformed() method.

A) paint()
B) paintComponent()
C) paintBorder()
D) repaint()
Question
The first step in drawing a 2D object is to specify how a drawn object is rendered.
Question
When a Swing object such as JPanel calls the repaint() method, it calls paint(), paintComponent(), paintBorder() , and which of the following?

A) paintChildren()
B) paintSuper()
C) paintBody()
D) paintGraphic()
Question
The ____ method requires four arguments and draws the outline of a rectangle using the current drawing color.

A) clearRect()
B) drawRect()
C) fillRect()
D) paintRect()
Question
When using the drawRoundRect() method, if you assign ____ to the arc coordinates, the rectangle is not rounded; instead, the corners are square.

A) -1
B) 0
C) 10
D) 99
Question
Both Rectangle2D.Float and Rectangle2D.Double can be created using four arguments representing the x-coordinate, y-coordinate, width, and height.
Question
You don't usually call the paint() method directly; instead the ____ method calls the paint() method.

A) destroy()
B) actionPerformed()
C) repaint()
D) super()
Question
The lineTo() method is used to define the beginning point of a polygon.
Question
You can instruct a Graphics object named g to produce green output by using which of the following statements?

A) g.makeColor(Color.GREEN);
B) g.makeColor(GREEN.Color);
C) g.setColor(Color.GREEN);
D) g.setColor( GREEN. Color);
Question
The ____ method provides information about the system in use.

A) getSystemInfo()
B) getDefaultToolkit()
C) getDefaultControlPanel()
D) getToolkit()
Question
If the beginning and ending points used with the fillPolygon() method are ____, the two endpoints are connected by a straight line before the polygon is filled with color.

A) connected
B) coordinate pairs
C) identical
D) not identical
Question
Which of the following statements starts a polygon named pol at the coordinates 20 and 290?

A) pol.moveTo(20F, 290F);
B) pol.lineTo(20F, 290F);
C) pol = new Path(20F, 290F);
D) pol.newPath(20F, 290F);
Question
You use the ____________________ method in statements to add points to a polygon.
Question
The ____________________ method can be used when a window needs to be updated, such as when it contains new images or you have moved a new object onto the screen.
Question
BasicStroke class variables determine the endcap and ____ style arguments.

A) stroke
B) line
C) juncture
D) fill
Question
You can discover the fonts that are available on your system by using the ____ method.

A) searchFonts()
B) findFonts()
C) findAllFonts()
D) getAvailableFontFamilyNames()
Question
The ____________________ method returns an object of type Dimension , which specifies the width and height of the screen in pixels.
Question
____ is the amount of space between the bottom of the descent of one line and the top of the characters in the successive line of type.

A) Descent
B) Ascent
C) Leading
D) Height of a line
Question
The ____ method creates a solid arc.

A) solidArc()
B) fillArc()
C) clearArc()
D) drawArc()
Question
The draw3DRect() method has a ____ argument, which controls whether the rectangle is darker on the right and bottom, or lighter on the right and bottom.

A) cyclic gradient
B) fill pattern
C) null
D) Boolean value
Question
Which FontMetrics class method returns information about the part of characters that hang below the baseline?

A) getLeading()
B) getAscent()
C) get_Descent()
D) getHeight()
Question
To create an arc object named halfArc that looks like the top half of a circle, which of the following statements can you use to produce identical results to this statement? halfArc.drawArc(x, y, w, h, 0, 180); .

A) halfArc.drawArc(x, y, w, h, 180, 0);
B) halfArc.drawArc(x, y, w, h, 180, -180);
C) halfArc.drawArc(x, y, w, h, -180, 180);
D) fillArc.drawArc(x, y, w, h, 180, -180);
Question
Which of the following statements will correctly add a point to a polygon named myShape ?

A) myShape.addPoint(50, 100)
B) addPoint = myShape(50, 100)
C) myShape.fillPolygon(50 100)
D) myShape = addPoint(50, 100)
Question
You can use the ____ method to copy any rectangular area to a new location.

A) copyRect()
B) copyArea()
C) copyGraphics()
D) addPoint()
Question
You can improve the appearance of strings drawn using Graphics objects by using the ____________________ method.
Question
You specify 2D colors by using the ____ method.

A) paint()
B) setPaint()
C) color()
D) setColor()
Question
You can instantiate an empty Polygon object using which of the following statements?

A) Polygon someFutureShape = new Polygon(0,0,0,0);
B) Polygon someFutureShape = new Polygon();
C) Polygon someFutureShape = new Polygon(0);
D) Polygon someFutureShape = new Polygon(xPoints, yPoints, xPoints.length);
Question
You use the ____________________ method to draw a rectangle that appears to have "shadowing" on two of its edges and light "highlights" on two others.
Question
Which of the following is a gradual shift from one color at one coordinate point to a different color at a second coordinate point?

A) color shift
B) gradient fill
C) fill pattern
D) cyclic fill
Question
Match between columns
A portion of a circle's circumference
painting
A portion of a circle's circumference
polygon
A portion of a circle's circumference
cyclic gradient
A portion of a circle's circumference
stroke
A portion of a circle's circumference
render
A portion of a circle's circumference
arc
A portion of a circle's circumference
ascent
A portion of a circle's circumference
gradient fill
A portion of a circle's circumference
descent
To paint or display a drawing
painting
To paint or display a drawing
polygon
To paint or display a drawing
cyclic gradient
To paint or display a drawing
stroke
To paint or display a drawing
render
To paint or display a drawing
arc
To paint or display a drawing
ascent
To paint or display a drawing
gradient fill
To paint or display a drawing
descent
A geometric figure with straight sides
painting
A geometric figure with straight sides
polygon
A geometric figure with straight sides
cyclic gradient
A geometric figure with straight sides
stroke
A geometric figure with straight sides
render
A geometric figure with straight sides
arc
A geometric figure with straight sides
ascent
A geometric figure with straight sides
gradient fill
A geometric figure with straight sides
descent
A gradual shift from one color to a different color
painting
A gradual shift from one color to a different color
polygon
A gradual shift from one color to a different color
cyclic gradient
A gradual shift from one color to a different color
stroke
A gradual shift from one color to a different color
render
A gradual shift from one color to a different color
arc
A gradual shift from one color to a different color
ascent
A gradual shift from one color to a different color
gradient fill
A gradual shift from one color to a different color
descent
Measures the height of an uppercase character from a baseline to the top
painting
Measures the height of an uppercase character from a baseline to the top
polygon
Measures the height of an uppercase character from a baseline to the top
cyclic gradient
Measures the height of an uppercase character from a baseline to the top
stroke
Measures the height of an uppercase character from a baseline to the top
render
Measures the height of an uppercase character from a baseline to the top
arc
Measures the height of an uppercase character from a baseline to the top
ascent
Measures the height of an uppercase character from a baseline to the top
gradient fill
Measures the height of an uppercase character from a baseline to the top
descent
A line-drawing feature in Java 2D that represents a single movement
painting
A line-drawing feature in Java 2D that represents a single movement
polygon
A line-drawing feature in Java 2D that represents a single movement
cyclic gradient
A line-drawing feature in Java 2D that represents a single movement
stroke
A line-drawing feature in Java 2D that represents a single movement
render
A line-drawing feature in Java 2D that represents a single movement
arc
A line-drawing feature in Java 2D that represents a single movement
ascent
A line-drawing feature in Java 2D that represents a single movement
gradient fill
A line-drawing feature in Java 2D that represents a single movement
descent
A fill pattern in which a shift between colors occurs repeatedly
painting
A fill pattern in which a shift between colors occurs repeatedly
polygon
A fill pattern in which a shift between colors occurs repeatedly
cyclic gradient
A fill pattern in which a shift between colors occurs repeatedly
stroke
A fill pattern in which a shift between colors occurs repeatedly
render
A fill pattern in which a shift between colors occurs repeatedly
arc
A fill pattern in which a shift between colors occurs repeatedly
ascent
A fill pattern in which a shift between colors occurs repeatedly
gradient fill
A fill pattern in which a shift between colors occurs repeatedly
descent
The act of redisplaying a surface
painting
The act of redisplaying a surface
polygon
The act of redisplaying a surface
cyclic gradient
The act of redisplaying a surface
stroke
The act of redisplaying a surface
render
The act of redisplaying a surface
arc
The act of redisplaying a surface
ascent
The act of redisplaying a surface
gradient fill
The act of redisplaying a surface
descent
Measures the part of characters that "hang below" the baseline
painting
Measures the part of characters that "hang below" the baseline
polygon
Measures the part of characters that "hang below" the baseline
cyclic gradient
Measures the part of characters that "hang below" the baseline
stroke
Measures the part of characters that "hang below" the baseline
render
Measures the part of characters that "hang below" the baseline
arc
Measures the part of characters that "hang below" the baseline
ascent
Measures the part of characters that "hang below" the baseline
gradient fill
Measures the part of characters that "hang below" the baseline
descent
Question
Write the statement to set the font of a Graphics object named myStyle to the font fancyFont .
Question
What activities does the process of drawing with Java 2D objects include?
Question
Write the statement to create an Arc2D.Float object named myArc at 20, 143, with a width of 50 and a height of 43; with a starting degree of 50, 140 degrees traveled; and using the class variable Arc2D.PIE .
Question
What parameters does the copyArea() method require?
Question
Describe what happens when a Swing component such as a JPanel calls the repaint() method.
Question
BasicStroke myLine = new BasicStroke(12.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND);
The above statement creates a BasicStroke object and makes it the current stroke. Describe the three arguments that are used in this statement, and then describe the purpose of each.
Question
To create a rectangle with rounded corners, the drawRoundRect() method is used. Describe the six arguments that are required to create rounded rectangles.
Question
How can a programmer find and gather all the available fonts on a computer system?
Question
Write the statement that uses an object named brush  to draw a string that says "I'm here" with the lower-left corner of the string appearing at coordinates x=100, y=110.
Question
How do you use the drawOval() method to draw an oval?
Question
The draw3DRect() method is used to draw rectangles that appear to have "shadowing" on two of their edges. Five arguments are used to create shadowed rectangles. Describe the five arguments.
Question
Write the statement to draw a rectangle using a graphics object named myRect that begins at position 30, 100 and is 150 pixels wide by 40 pixels tall.
Question
In the drawPolygon() method, what are the three arguments and what values do they represent?
Question
List the six arguments you need to provide for the drawArc() method.
Question
A Polygon object is created by defining movements from one point to another. Describe the statements that are used to create a Polygon object.
Question
Write the statement that will create a BasicStroke object named myLine and make it the current stroke. The line width should be 3, the endcap style should be CAP_ROUND and the juncture style should be JOIN_BEVEL .
Question
Why would a programmer use the repaint() method?
Question
What are the three arguments the BasicStroke constructor takes?
Question
What are the constructors for the Dimension class?
Question
The getFontMetrics() method can be used to discover a font's statistics. Describe the getLeading() , getAscent() , getDescent() , and getHeight() methods, and how they are used with the getFontMetrics() method.
Question
Write the statement to create a Rectangle2D.Float object named myRect at 20, 20 with a width of 80 and height of 50.
Question
Write the setPaint() statement that will set a cyclic gradient that cycles between red and yellow that begins at coordinates 40, 60 and ends at coordinates 210, 120. The 2D graphics object you use in the statement should be named graph2D.
Question
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
public class JDemo3DRectangles extends JPanel
{
   @Override
   public void paint(Graphics gr)
   {
      super.paint(gr);
      final int WIDTH = 60, HEIGHT = 80;
      gr.setColor(Color.PINK);
      gr.fill3DRect(20, 40, WIDTH, HEIGHT, true);
      gr.fill3DRect(100, 40, WIDTH, HEIGHT, false);
   }
   public static void main(String[] args)
   {
      JFrame frame = new JFrame();
      frame.add(new JDemo3DRectangles());;
      frame.setSize(200, 180);
      frame.setVisible(true);
   }
}
The highlighted code above creates two filled 3D rectangles. Describe how the color of the rectangles is set, and explain the five arguments that are used to draw the rectangles.
Question
A rectangle is drawn with the following statement:
tool.drawRect(50, 50, 100, 60);
An oval is drawn with the following statement:
tool.drawOval(50, 50, 100, 60);
Describe the resulting output, and describe how the four arguments are used to draw the objects.
Question
Write the statement to instruct a Graphics object named myGraphic to apply blue paint.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/66
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 16: Graphics
1
The drawRoundRect() method requires ____ arguments.

A) three
B) four
C) six
D) eight
C
2
You can instruct a Graphics object to use a font by inserting the font as the argument in a ____ method.

A) setColor()
B) drawString()
C) setCharacters()
D) setFont()
D
3
In Java, whether a paint request is triggered by the system or an application, a Component's paint() method is invoked.
True
4
The ____ method draws what appears to be an empty rectangle.

A) clearRect()
B) emptyRect()
C) fillRect()
D) drawRect()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
5
The ____ method in the Graphics class allows you to draw a String on a JPanel or other component .

A) drawString()
B) setFont()
C) drawLine()
D) setString()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
6
The statements pen.drawLine(50, 50, 100, 200); and pen.drawLine(100, 200, 50, 50); will both draw straight lines that slant down and to the right.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
7
The drawPolygon() method requires four arguments, two integer arrays, and two single integers.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
8
System-triggered painting occurs when a program requests it, usually because the internal state of a component has changed.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
9
A rectangle created with the clearRect() method is not transparent.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
10
The getScreenSize()  method returns an object of type Pixels , which specifies the width  and height of the screen in pixels.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
11
The FontMetrics class methods return an integer value representing the font size in points, with one point measuring 1/72 of an inch.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
12
If you want to change graphic output on a panel in response to a user's mouse click, you would place a call to ____ in the actionPerformed() method.

A) paint()
B) paintComponent()
C) paintBorder()
D) repaint()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
13
The first step in drawing a 2D object is to specify how a drawn object is rendered.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
14
When a Swing object such as JPanel calls the repaint() method, it calls paint(), paintComponent(), paintBorder() , and which of the following?

A) paintChildren()
B) paintSuper()
C) paintBody()
D) paintGraphic()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
15
The ____ method requires four arguments and draws the outline of a rectangle using the current drawing color.

A) clearRect()
B) drawRect()
C) fillRect()
D) paintRect()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
16
When using the drawRoundRect() method, if you assign ____ to the arc coordinates, the rectangle is not rounded; instead, the corners are square.

A) -1
B) 0
C) 10
D) 99
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
17
Both Rectangle2D.Float and Rectangle2D.Double can be created using four arguments representing the x-coordinate, y-coordinate, width, and height.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
18
You don't usually call the paint() method directly; instead the ____ method calls the paint() method.

A) destroy()
B) actionPerformed()
C) repaint()
D) super()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
19
The lineTo() method is used to define the beginning point of a polygon.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
20
You can instruct a Graphics object named g to produce green output by using which of the following statements?

A) g.makeColor(Color.GREEN);
B) g.makeColor(GREEN.Color);
C) g.setColor(Color.GREEN);
D) g.setColor( GREEN. Color);
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
21
The ____ method provides information about the system in use.

A) getSystemInfo()
B) getDefaultToolkit()
C) getDefaultControlPanel()
D) getToolkit()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
22
If the beginning and ending points used with the fillPolygon() method are ____, the two endpoints are connected by a straight line before the polygon is filled with color.

A) connected
B) coordinate pairs
C) identical
D) not identical
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following statements starts a polygon named pol at the coordinates 20 and 290?

A) pol.moveTo(20F, 290F);
B) pol.lineTo(20F, 290F);
C) pol = new Path(20F, 290F);
D) pol.newPath(20F, 290F);
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
24
You use the ____________________ method in statements to add points to a polygon.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
25
The ____________________ method can be used when a window needs to be updated, such as when it contains new images or you have moved a new object onto the screen.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
26
BasicStroke class variables determine the endcap and ____ style arguments.

A) stroke
B) line
C) juncture
D) fill
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
27
You can discover the fonts that are available on your system by using the ____ method.

A) searchFonts()
B) findFonts()
C) findAllFonts()
D) getAvailableFontFamilyNames()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
28
The ____________________ method returns an object of type Dimension , which specifies the width and height of the screen in pixels.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
29
____ is the amount of space between the bottom of the descent of one line and the top of the characters in the successive line of type.

A) Descent
B) Ascent
C) Leading
D) Height of a line
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
30
The ____ method creates a solid arc.

A) solidArc()
B) fillArc()
C) clearArc()
D) drawArc()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
31
The draw3DRect() method has a ____ argument, which controls whether the rectangle is darker on the right and bottom, or lighter on the right and bottom.

A) cyclic gradient
B) fill pattern
C) null
D) Boolean value
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
32
Which FontMetrics class method returns information about the part of characters that hang below the baseline?

A) getLeading()
B) getAscent()
C) get_Descent()
D) getHeight()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
33
To create an arc object named halfArc that looks like the top half of a circle, which of the following statements can you use to produce identical results to this statement? halfArc.drawArc(x, y, w, h, 0, 180); .

A) halfArc.drawArc(x, y, w, h, 180, 0);
B) halfArc.drawArc(x, y, w, h, 180, -180);
C) halfArc.drawArc(x, y, w, h, -180, 180);
D) fillArc.drawArc(x, y, w, h, 180, -180);
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following statements will correctly add a point to a polygon named myShape ?

A) myShape.addPoint(50, 100)
B) addPoint = myShape(50, 100)
C) myShape.fillPolygon(50 100)
D) myShape = addPoint(50, 100)
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
35
You can use the ____ method to copy any rectangular area to a new location.

A) copyRect()
B) copyArea()
C) copyGraphics()
D) addPoint()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
36
You can improve the appearance of strings drawn using Graphics objects by using the ____________________ method.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
37
You specify 2D colors by using the ____ method.

A) paint()
B) setPaint()
C) color()
D) setColor()
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
38
You can instantiate an empty Polygon object using which of the following statements?

A) Polygon someFutureShape = new Polygon(0,0,0,0);
B) Polygon someFutureShape = new Polygon();
C) Polygon someFutureShape = new Polygon(0);
D) Polygon someFutureShape = new Polygon(xPoints, yPoints, xPoints.length);
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
39
You use the ____________________ method to draw a rectangle that appears to have "shadowing" on two of its edges and light "highlights" on two others.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
40
Which of the following is a gradual shift from one color at one coordinate point to a different color at a second coordinate point?

A) color shift
B) gradient fill
C) fill pattern
D) cyclic fill
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
A portion of a circle's circumference
painting
A portion of a circle's circumference
polygon
A portion of a circle's circumference
cyclic gradient
A portion of a circle's circumference
stroke
A portion of a circle's circumference
render
A portion of a circle's circumference
arc
A portion of a circle's circumference
ascent
A portion of a circle's circumference
gradient fill
A portion of a circle's circumference
descent
To paint or display a drawing
painting
To paint or display a drawing
polygon
To paint or display a drawing
cyclic gradient
To paint or display a drawing
stroke
To paint or display a drawing
render
To paint or display a drawing
arc
To paint or display a drawing
ascent
To paint or display a drawing
gradient fill
To paint or display a drawing
descent
A geometric figure with straight sides
painting
A geometric figure with straight sides
polygon
A geometric figure with straight sides
cyclic gradient
A geometric figure with straight sides
stroke
A geometric figure with straight sides
render
A geometric figure with straight sides
arc
A geometric figure with straight sides
ascent
A geometric figure with straight sides
gradient fill
A geometric figure with straight sides
descent
A gradual shift from one color to a different color
painting
A gradual shift from one color to a different color
polygon
A gradual shift from one color to a different color
cyclic gradient
A gradual shift from one color to a different color
stroke
A gradual shift from one color to a different color
render
A gradual shift from one color to a different color
arc
A gradual shift from one color to a different color
ascent
A gradual shift from one color to a different color
gradient fill
A gradual shift from one color to a different color
descent
Measures the height of an uppercase character from a baseline to the top
painting
Measures the height of an uppercase character from a baseline to the top
polygon
Measures the height of an uppercase character from a baseline to the top
cyclic gradient
Measures the height of an uppercase character from a baseline to the top
stroke
Measures the height of an uppercase character from a baseline to the top
render
Measures the height of an uppercase character from a baseline to the top
arc
Measures the height of an uppercase character from a baseline to the top
ascent
Measures the height of an uppercase character from a baseline to the top
gradient fill
Measures the height of an uppercase character from a baseline to the top
descent
A line-drawing feature in Java 2D that represents a single movement
painting
A line-drawing feature in Java 2D that represents a single movement
polygon
A line-drawing feature in Java 2D that represents a single movement
cyclic gradient
A line-drawing feature in Java 2D that represents a single movement
stroke
A line-drawing feature in Java 2D that represents a single movement
render
A line-drawing feature in Java 2D that represents a single movement
arc
A line-drawing feature in Java 2D that represents a single movement
ascent
A line-drawing feature in Java 2D that represents a single movement
gradient fill
A line-drawing feature in Java 2D that represents a single movement
descent
A fill pattern in which a shift between colors occurs repeatedly
painting
A fill pattern in which a shift between colors occurs repeatedly
polygon
A fill pattern in which a shift between colors occurs repeatedly
cyclic gradient
A fill pattern in which a shift between colors occurs repeatedly
stroke
A fill pattern in which a shift between colors occurs repeatedly
render
A fill pattern in which a shift between colors occurs repeatedly
arc
A fill pattern in which a shift between colors occurs repeatedly
ascent
A fill pattern in which a shift between colors occurs repeatedly
gradient fill
A fill pattern in which a shift between colors occurs repeatedly
descent
The act of redisplaying a surface
painting
The act of redisplaying a surface
polygon
The act of redisplaying a surface
cyclic gradient
The act of redisplaying a surface
stroke
The act of redisplaying a surface
render
The act of redisplaying a surface
arc
The act of redisplaying a surface
ascent
The act of redisplaying a surface
gradient fill
The act of redisplaying a surface
descent
Measures the part of characters that "hang below" the baseline
painting
Measures the part of characters that "hang below" the baseline
polygon
Measures the part of characters that "hang below" the baseline
cyclic gradient
Measures the part of characters that "hang below" the baseline
stroke
Measures the part of characters that "hang below" the baseline
render
Measures the part of characters that "hang below" the baseline
arc
Measures the part of characters that "hang below" the baseline
ascent
Measures the part of characters that "hang below" the baseline
gradient fill
Measures the part of characters that "hang below" the baseline
descent
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
42
Write the statement to set the font of a Graphics object named myStyle to the font fancyFont .
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
43
What activities does the process of drawing with Java 2D objects include?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
44
Write the statement to create an Arc2D.Float object named myArc at 20, 143, with a width of 50 and a height of 43; with a starting degree of 50, 140 degrees traveled; and using the class variable Arc2D.PIE .
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
45
What parameters does the copyArea() method require?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
46
Describe what happens when a Swing component such as a JPanel calls the repaint() method.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
47
BasicStroke myLine = new BasicStroke(12.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND);
The above statement creates a BasicStroke object and makes it the current stroke. Describe the three arguments that are used in this statement, and then describe the purpose of each.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
48
To create a rectangle with rounded corners, the drawRoundRect() method is used. Describe the six arguments that are required to create rounded rectangles.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
49
How can a programmer find and gather all the available fonts on a computer system?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
50
Write the statement that uses an object named brush  to draw a string that says "I'm here" with the lower-left corner of the string appearing at coordinates x=100, y=110.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
51
How do you use the drawOval() method to draw an oval?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
52
The draw3DRect() method is used to draw rectangles that appear to have "shadowing" on two of their edges. Five arguments are used to create shadowed rectangles. Describe the five arguments.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
53
Write the statement to draw a rectangle using a graphics object named myRect that begins at position 30, 100 and is 150 pixels wide by 40 pixels tall.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
54
In the drawPolygon() method, what are the three arguments and what values do they represent?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
55
List the six arguments you need to provide for the drawArc() method.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
56
A Polygon object is created by defining movements from one point to another. Describe the statements that are used to create a Polygon object.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
57
Write the statement that will create a BasicStroke object named myLine and make it the current stroke. The line width should be 3, the endcap style should be CAP_ROUND and the juncture style should be JOIN_BEVEL .
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
58
Why would a programmer use the repaint() method?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
59
What are the three arguments the BasicStroke constructor takes?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
60
What are the constructors for the Dimension class?
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
61
The getFontMetrics() method can be used to discover a font's statistics. Describe the getLeading() , getAscent() , getDescent() , and getHeight() methods, and how they are used with the getFontMetrics() method.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
62
Write the statement to create a Rectangle2D.Float object named myRect at 20, 20 with a width of 80 and height of 50.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
63
Write the setPaint() statement that will set a cyclic gradient that cycles between red and yellow that begins at coordinates 40, 60 and ends at coordinates 210, 120. The 2D graphics object you use in the statement should be named graph2D.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
64
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
public class JDemo3DRectangles extends JPanel
{
   @Override
   public void paint(Graphics gr)
   {
      super.paint(gr);
      final int WIDTH = 60, HEIGHT = 80;
      gr.setColor(Color.PINK);
      gr.fill3DRect(20, 40, WIDTH, HEIGHT, true);
      gr.fill3DRect(100, 40, WIDTH, HEIGHT, false);
   }
   public static void main(String[] args)
   {
      JFrame frame = new JFrame();
      frame.add(new JDemo3DRectangles());;
      frame.setSize(200, 180);
      frame.setVisible(true);
   }
}
The highlighted code above creates two filled 3D rectangles. Describe how the color of the rectangles is set, and explain the five arguments that are used to draw the rectangles.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
65
A rectangle is drawn with the following statement:
tool.drawRect(50, 50, 100, 60);
An oval is drawn with the following statement:
tool.drawOval(50, 50, 100, 60);
Describe the resulting output, and describe how the four arguments are used to draw the objects.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
66
Write the statement to instruct a Graphics object named myGraphic to apply blue paint.
Unlock Deck
Unlock for access to all 66 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 66 flashcards in this deck.