Errata

Java 2D Graphics

Errata for Java 2D Graphics

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page Index
In chapter 6, there's an example called 'TextRendering.java'.

This class makes use of a class called 'ApplicationFrame'.
I looked in the index and found no reference to this class.
At the beginning of the book, on page 8, I found a description
of this class, and I was able to deduce that the drawing that
took place in the example could also be done in a regular, AWT
frame. I really think that this class, 'ApplicationFrame',
should be included in the index. It seems to turn up in just
about every example. Insert an index entry of

ApplicationFrame, 8

Anonymous   
Printed
Page 2
In the second paragraph, the last package was listed as

"com.sun.image.code.jpeg"

it now reads:

"com.sun.image.codec.jpeg"

Anonymous    Jul 01, 2001
Printed
Page 2
In the second paragraph, the last package is listed as

"com.sun.image.code.jpeg"

it should read:

"com.sun.image.codec.jpeg"

Anonymous   
Printed
Page 8
In the third line of the 1st paragraph, 'createGraphics()' is

replaced by 'getGraphics()'.

Anonymous    Jul 01, 2001
Printed
Page 8
In the third line of the 1st paragraph, 'createGraphics()' should be

replaced by 'getGraphics()'. The method call in the following listing is
correct.

Anonymous   
Printed
Page 15
Step 3 once stated:

"The paint() method draws the picture you see in
Figure 1-1."

it now reads:

"...in Figure C-1 (in the color insert)."

Anonymous    Jul 01, 2001
Printed
Page 15
Step 3 states "The paint() method draws the picture you see in

Figure 1-1." It should say "in Figure C-1 (in the color insert)."

Anonymous   
Printed
Page 32-33
Figures 3.5 and 3.7 have the control points labeled as the

filled squares and the endpoints are the unfilled squares
when in fact the control point should be labeled as the open
squares and the endpoint as the filled squares.

Anonymous   
Printed
Page 36
In Figure 3-9, the numbers should run from 0 through 6, NOT 1

through 7. Otherwise, the text that begins at the bottom of
page 35 says the exact opposite of what the author intended.

Anonymous   
Printed
Page 76
IN PRINT: 6th line from top

"halfLength
This is half of the line width."

SHOULD BE:
"halfWidth
This is half of the line width."

Anonymous   
Printed
Page 76
last paragraph

In the paragraph "Dashes", the description of dash array:
"The even elements of the array (starting at index 0) determine where the line is
visible, while the odd elements determine where it's invisible." is technically
incorrect.

In fact, BasicStroke "cyclic" applies the dash array elements to alternates visible
and invisible.

For example: an array like {10, 20, 30} (odd number of array elements and phase == 0)
will first 10 units visible, then 20 units invisible, then 30 units visible, then 10
units invisible, then 20 units visible, ... etc

As the result shown, because "cyclic" rule, we cannot say the even elements are
always visible and the odd elements are always invisible.
(if the number of dash array is not even)

Anonymous   
Printed
Page 89
In the box, there was a typo in the first paragraph.

The text once read:

"AffineTransfrom"

it now reads:

"AffineTransform"

Anonymous    Jul 01, 2001
Printed
Page 89
In the box, there is a typo in the first paragraph.

The text currently reads:

"AffineTransfrom"

It should read:

"AffineTransform"

Anonymous   
Printed
Page 107
2nd paragraph;

The code example:
hints.add(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDERING_ON);
is incorrect.

It can be fixed by changing "add" to "put" and changing
"VALUE_RENDER_ON" to "VALUE_RENDER_QUALITY". The resulting code excerpt
is:

public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
RenderingHints hints = new RenderingHints(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHints(hints);
// ...

Anonymous   
Printed
Page 111
Just under the heading "Drawing Text," the book invited the

reader to "use one of Graphics2D's drawText() methods" to render text.

it now reads:

"use one of Graphics2D's drawString() method"

Anonymous    Jul 01, 2001
Printed
Page 111
Just under the heading "Drawing Text," the book invites the

reader to "use one of Graphics2D's drawText() methods" to render text.

it should read:

"use one of Graphics2D's drawString() method"

Anonymous   
Printed
Page 245
code output

The output on Win32/jdk1.3 and MacOSX/jdk1.3 is:

java.awt.Color[r=255,g=0,b=0] -> 0
java.awt.Color[r=0,g=255,b=0] -> 1
java.awt.Color[r=0,g=0,b=255] -> 2
java.awt.Color[r=64,g=255,b=64] -> 1
java.awt.Color[r=255,g=255,b=0] -> 0
java.awt.Color[r=0,g=255,b=255] -> 1
0 -> unnormalized components 255 0 0
1 -> unnormalized components 0 255 0
2 -> unnormalized components 0 0 255
3 -> unnormalized components 255 255 255
4 -> unnormalized components 0 0 0

Anonymous    Jul 01, 2001
Printed
Page 245
code output

The output on Win32/jdk1.3 and MacOSX/jdk1.3 is:

java.awt.Color[r=255,g=0,b=0] -> 0
java.awt.Color[r=0,g=255,b=0] -> 1
java.awt.Color[r=0,g=0,b=255] -> 2
java.awt.Color[r=64,g=255,b=64] -> 1
java.awt.Color[r=255,g=255,b=0] -> 0
java.awt.Color[r=0,g=255,b=255] -> 1
0 -> unnormalized components 255 0 0
1 -> unnormalized components 0 255 0
2 -> unnormalized components 0 0 255
3 -> unnormalized components 255 255 255
4 -> unnormalized components 0 0 0

The book has extra 255's at the end of the last 5 lines. This is
incorrect.

Anonymous   
Printed
Page 300
In the sixth line of the print () method

"paint(g2)"

now reads:

"paintComponent(g2)"

Anonymous    Jul 01, 2001
Printed
Page 300
In the sixth line of the print () method

"paint(g2)"

should read:

"paintComponent(g2)"

Anonymous