Exam 16: Graphics
Exam 1: Creating Java Programs61 Questions
Exam 2: Using Data67 Questions
Exam 3: Using Methods Classes and Objects66 Questions
Exam 4: More Object Concepts66 Questions
Exam 5: Making Decisions66 Questions
Exam 6: Looping66 Questions
Exam 7: Characters Strings and the Stringbuilder68 Questions
Exam 8: Arrays66 Questions
Exam 9: Advanced Array Concepts66 Questions
Exam 10: Introduction to Inheritance66 Questions
Exam 11: Advanced Inheritance Concepts66 Questions
Exam 12: Exception Handling66 Questions
Exam 13: File Input and Output66 Questions
Exam 14: Introduction to Swing Components66 Questions
Exam 15: Advanced Gui Topics66 Questions
Exam 16: Graphics66 Questions
Select questions type
Write the statement to instruct a Graphics object named myGraphic to apply blue paint.
Free
(Short Answer)
4.7/5
(40)
Correct Answer:
myGraphic.setColor(Color.BLUE);
Describe what happens when a Swing component such as a JPanel calls the repaint() method.
Free
(Essay)
4.9/5
(33)
Correct Answer:
When a Swing object such as a JPanel calls the repaint() method, it not only calls paint() , it calls three other methods named paintComponent(), paintBorder(), and paintChildren() . Java's creators recommend that classes that extend Swing components should place all drawing code in a paintComponent() method that overrides the parent class version of the method.
Which of the following is a gradual shift from one color at one coordinate point to a different color at a second coordinate point?
Free
(Multiple Choice)
4.9/5
(35)
Correct Answer:
B
Both Rectangle2D.Float and Rectangle2D.Double can be created using four arguments representing the x-coordinate, y-coordinate, width, and height.
(True/False)
4.8/5
(26)
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
(35)
The ____ method draws what appears to be an empty rectangle.
(Multiple Choice)
4.8/5
(41)
The ____ method in the Graphics class allows you to draw a String on a JPanel or other component .
(Multiple Choice)
4.9/5
(26)
You don't usually call the paint() method directly; instead the ____ method calls the paint() method.
(Multiple Choice)
4.8/5
(42)
System-triggered painting occurs when a program requests it, usually because the internal state of a component has changed.
(True/False)
4.9/5
(41)
When a Swing object such as JPanel calls the repaint() method, it calls paint(), paintComponent(), paintBorder() , and which of the following?
(Multiple Choice)
4.8/5
(36)
You can use the ____ method to copy any rectangular area to a new location.
(Multiple Choice)
4.8/5
(40)
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 .
(Essay)
4.9/5
(37)
The ____________________ method returns an object of type Dimension , which specifies the width and height of the screen in pixels.
(Short Answer)
4.9/5
(35)
You use the ____________________ method to draw a rectangle that appears to have "shadowing" on two of its edges and light "highlights" on two others.
(Short Answer)
4.8/5
(37)
Write the statement to set the font of a Graphics object named myStyle to the font fancyFont .
(Short Answer)
4.8/5
(38)
You can improve the appearance of strings drawn using Graphics objects by using the ____________________ method.
(Short Answer)
4.8/5
(38)
The FontMetrics class methods return an integer value representing the font size in points, with one point measuring 1/72 of an inch.
(True/False)
4.8/5
(35)
Showing 1 - 20 of 66
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)