In this chapter we talk about several kinds of encodings of data (or objects).
Pictures
Objects of our Picture class
Pictures are encodings of images, typically coming from a JPEG file.
Sounds
Objects of our Sound class
Sounds are encodings of sounds, typically coming from a WAV file.
Strings
Java String object, e.g., "Hello"
A sequence of characters (including spaces, punctuation, etc.) delimited on either end with a double-quote character.
Turtles
Objects of our Turtle class
Turtles can move forward, turn left, turn right, turn by a specified angle, and leave a trail.
Worlds
Objects of our World class
Worlds can hold objects, such as objects of the Turtle class.
[Page 71]
Here are the methods introduced in this chapter:
Character.getNumericValue (Character character)
Returns the equivalent numeric value in Unicode for the input character.
FileChooser.pickAFile()
Lets the user pick a file and returns the complete path name as a string.
Math.abs(int number)
Takes a number and returns the absolute value of it.
show()
Shows the Picture object that it is invoked on. No return value.
play()
Plays the sound object (object of the Sound class) that it is invoked on. No return value.
forward(int numberOfSteps)
Asks the Turtle object that it is invoked on to move forward by the passed number of steps. No return value.
setPenDown(boolean value)
Asks the Turtle object that it is invoked on to set the pen up or down depending on the passed value. If you pass in false for value, the pen is lifted and no trail will be drawn when the turtle moves. If you pass in true, the pen will be put down and the trail will be drawn.
hide()
Asks the Turtle object that it is invoked on to stop showing itself. No return value.
moveTo(int x, int y)
Asks the Turtle object that it is invoked on to move to the specified x and y location. No return value.
penDown()
Asks the Turtle object that it is invoked on to put down the pen and draw the trail of future movements. No return value.
penUp()
Asks the Turtle object that it is invoked on to pick up the pen so you don't see the trail of future movements. No return value.
show()
Asks the Turtle object that it is invoked on to show (draw) itself. No return value.
turn(int angle)
Asks the Turtle object that it is invoked on to turn by the specified angle. A negative angle will turn that much to the left and a positive angle will turn that much to the right. No return value.
turnLeft()
Asks the Turtle object that it is invoked on to turn left 90 degrees. No return value.
turnRight()
Asks the Turtle object that it is invoked on to turn right 90 degrees. No return value.