Exam 16: Graphics

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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.

(Multiple Choice)
5.0/5
(30)

In Java, whether a paint request is triggered by the system or an application, a Component's paint() method is invoked.

(True/False)
4.7/5
(41)

A rectangle created with the clearRect() method is not transparent.

(True/False)
4.9/5
(40)

You can instantiate an empty Polygon object using which of the following statements?

(Multiple Choice)
4.8/5
(42)

How do you use the drawOval() method to draw an oval?

(Essay)
4.8/5
(37)

____ 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.

(Multiple Choice)
4.9/5
(28)

You can discover the fonts that are available on your system by using the ____ method.

(Multiple Choice)
4.7/5
(42)

When using the drawRoundRect() method, if you assign ____ to the arc coordinates, the rectangle is not rounded; instead, the corners are square.

(Multiple Choice)
4.7/5
(37)

Why would a programmer use the repaint() method?

(Essay)
4.9/5
(40)

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); .

(Multiple Choice)
4.9/5
(44)

The ____ method creates a solid arc.

(Multiple Choice)
4.9/5
(38)

The ____ method requires four arguments and draws the outline of a rectangle using the current drawing color.

(Multiple Choice)
4.8/5
(28)

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.

(Essay)
4.9/5
(34)
Match each term with the correct statement below.
A portion of a circle's circumference
cyclic gradient
To paint or display a drawing
render
A geometric figure with straight sides
ascent
Correct Answer:
Verified
Premises:
Responses:
A portion of a circle's circumference
cyclic gradient
To paint or display a drawing
render
A geometric figure with straight sides
ascent
A gradual shift from one color to a different color
descent
Measures the height of an uppercase character from a baseline to the top
arc
A line-drawing feature in Java 2D that represents a single movement
gradient fill
A fill pattern in which a shift between colors occurs repeatedly
stroke
The act of redisplaying a surface
painting
Measures the part of characters that "hang below" the baseline
polygon
(Matching)
4.9/5
(32)

You can instruct a Graphics object named g to produce green output by using which of the following statements?

(Multiple Choice)
4.9/5
(43)

What are the three arguments the BasicStroke constructor takes?

(Essay)
4.8/5
(35)

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.

(Essay)
4.9/5
(32)

The drawPolygon() method requires four arguments, two integer arrays, and two single integers.

(True/False)
4.8/5
(32)

Write the statement to create a Rectangle2D.Float object named myRect at 20, 20 with a width of 80 and height of 50.

(Essay)
4.8/5
(32)

In the drawPolygon() method, what are the three arguments and what values do they represent?

(Essay)
4.8/5
(35)
Showing 21 - 40 of 66
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)