Chapter 12: Problem 2
State whether each of the following is true or false. If false, explain why. a) The first two arguments of Graphics method draw0val specify the center coordinate of the oval. b) In the Java coordinate system, \(x\) -values increase from left to right. c) Graphics method fillPolygon draws a filled polygon in the current color. d) Graphics method drawArc allows negative angles. e) Graphics method getSize returns the size of the current font in centimeters. f) Pixel coordinate (0,0) is located at the exact center of the monitor.
Short Answer
Step by step solution
Understanding the 'drawOval' Method
Java Coordinate System Analysis
Exploring 'fillPolygon' Method Functionality
Draw Arc Functionality Examination
Evaluating 'getSize' Method
Coordinate System Center Investigation
Unlock Step-by-Step Solutions & Ace Your Exams!
-
Full Textbook Solutions
Get detailed explanations and key concepts
-
Unlimited Al creation
Al flashcards, explanations, exams and more...
-
Ads-free access
To over 500 millions flashcards
-
Money-back guarantee
We refund you if you fail your exam.
Over 30 million students worldwide already upgrade their learning with Vaia!
Key Concepts
These are the key concepts you need to understand to accurately answer the question.
Java coordinate system
When you move across the screen from left to right, the x-values indeed increase, much like you would expect with positive x-values in graphing.
As you move downwards on the screen, the y-values increase. This may seem counterintuitive because, in typical mathematical graphs, y-values increase as you move up.
- The origin is at the top-left: (0,0)
- X-values increase from left to right
- Y-values increase top to bottom.
drawOval method
Contrary to what some may think, the `x` and `y` parameters don't set the oval's center. Instead, they indicate the upper-left corner of the rectangle that would bound the oval.
Here's how it works:
- `x` and `y` specify the top-left corner of the bounding rectangle
- `width` and `height` determine the size of the oval
fillPolygon method
You provide arrays of vertices (points) that determine the corners of your polygon. Consequently, the method will fill in the shape using the current drawing color specified by the graphics context.
- Define vertices with two arrays: `int xPoints[]` and `int yPoints[]`
- `int nPoints` specifies the number of points (vertices)
- The polygon is automatically filled with the current color
drawArc method
One of the key features of `drawArc` is the ability to accept negative angles. Negative angles allow for arcs to be drawn in a clockwise direction, as opposed to the counter-clockwise, which is the default.
- Angles are measured in degrees
- A negative angle draws clockwise
- Use a positive angle for counter-clockwise drawing
Java Font size measurement
The method `getSize()` from a Font object returns the font size in these points, not in centimeters or any other unit.
Understanding how many points translate into physical sizes depends on your display or printer settings, as one point generally equals 1/72 of an inch.
- Points measure the size of the font (1 point is 1/72 of an inch)
- `getSize()` method provides the size in points