Exam 16: Graphics
Exam 1: Creating Java Programs68 Questions
Exam 2: Using Data74 Questions
Exam 3: Using Methods, Classes, and Objects68 Questions
Exam 4: More Object Concepts67 Questions
Exam 5: Making Decisions70 Questions
Exam 6: Looping72 Questions
Exam 7: Characters, Strings, and the Stringbuilder73 Questions
Exam 8: Arrays74 Questions
Exam 9: Advanced Array Concepts74 Questions
Exam 10: Introduction to Inheritance70 Questions
Exam 11: Advanced Inheritance Concepts70 Questions
Exam 12: Exception Handling65 Questions
Exam 13: File Input and Output74 Questions
Exam 14: Introduction to Swing Components74 Questions
Exam 15: Advanced Gui Topics69 Questions
Exam 16: Graphics74 Questions
Exam 17: Applets, Images, and Sound72 Questions
Select questions type
The position of a component can be changed by using the ____ method and passing it x- and y-coordinate positions.
Free
(Multiple Choice)
4.8/5
(37)
Correct Answer:
B
To create a rectangle with rounded corners, the drawRoundRect() method is used. Describe the six arguments that are required to create rounded rectangles.
Free
(Essay)
4.9/5
(41)
Correct Answer:
The first four arguments match the four arguments required to draw a rectangle: the x- and y-coordinates of the upper-left corner, the width, and the height. The two additional arguments represent the arc width and height associated with the rounded corners (an arc is a portion of a circle). If you assign zeros to the arc coordinates, the rectangle is not rounded; instead, the corners are square. At the other extreme, if you assign values to the arc coordinates that are at least the width and height of the rectangle, the rectangle is so rounded that it is a circle.
You can use the ____ method to copy any rectangular area to a new location.
Free
(Multiple Choice)
4.7/5
(36)
Correct Answer:
B
Which of the following statements starts a polygon named pol at the coordinates 20 and 290?
(Multiple Choice)
4.8/5
(38)
Which statement sets the font of a Graphics object named brush to boldFont?
(Multiple Choice)
5.0/5
(35)
The ____________________ method returns an object of type Dimension, which specifies the width and height of the screen in pixels.
(Short Answer)
4.8/5
(41)
The init() method of GeneralPath is used to create the beginning point of the polygon.
(True/False)
4.9/5
(36)
You can instruct a Graphics object to use a font by inserting the font as the argument in a ____ method.
(Multiple Choice)
4.8/5
(49)
Match each term with the correct statement below.
-Works best with lighter drawing colors
(Multiple Choice)
4.9/5
(38)
import javax.swing.*;
import java.awt.*;
public class JDemoFont extends JFrame
{
Font bigFont = new Font("Serif", Font.ITALIC, 48);
String hello = "Hello";
public void paint(Graphics brush)
{
super.paint(brush);
brush.setFont(bigFont);
brush.drawString(hello, 10, 100);
}
public static void main(String[] args)
{
JDemoFont frame = new JDemoFont();
frame.setSize(180, 150);
frame.setVisible(true);
}
}
The above code shows an application that uses the setFont() method with a Graphics object named brush. Describe what will occur when the two shaded lines of code are executed.
(Essay)
4.9/5
(41)
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.
(Multiple Choice)
4.8/5
(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.
(Multiple Choice)
4.9/5
(36)
Match each term with the correct statement below.
-Returns the number of pixels as an integer
(Multiple Choice)
4.7/5
(41)
Match each term with the correct statement below.
-A Color class constant
(Multiple Choice)
4.8/5
(33)
Match each term with the correct statement below.
-Draws a solid shape
(Multiple Choice)
5.0/5
(33)
Showing 1 - 20 of 74
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)