| Input/Output |
boolean |
readBoolean()
| Returns boolean value typed in by user, expects true or false |
Color |
readColor()
| Returns Color value typed in by user, expects any of the names of Color Vales listed in the Color Values page (ex: Light blue) |
double |
readDouble()
| Returns double value typed in by user, expects any double value (ex: 3.25) |
int |
readInt()
| Returns int value typed in by user, expects any integer value (ex: -5) |
String |
readString()
| Returns String value typed in by user, expects any String value (ex: "I like to ride my bike.") |
void |
print(String str)
| Prints out a String to the screen |
void |
print(int num)
| Prints out an int to the screen |
void |
print(double num)
| Prints out a double to the screen |
void |
print(Color color)
| Prints out a Color to the screen |
void |
print(boolean bool)
| Prints out a boolean to the screen |
void |
printLine(String str)
| Prints out a String to the screen on its own line |
void |
printLine(int num)
| Prints out an int to the screen on its own line |
void |
printLine(double num)
| Prints out a double to the screen on its own line |
void |
printLine(Color color)
| Prints out a Color to the screen on its own line |
void |
printLine(boolean bool)
| Prints out a boolean to the screen on its own line |
| Graphics |
void |
setColor(Color color)
| Sets the foreground color for the drawing area. After setting the color, shapes you draw with functions
like fillCircle(x, y, radius) will be in this color |
void |
setBackgroundColor(Color color)
| Sets the background color of the drawing area |
void |
drawLine(int x1,
int y1, int x2, int y2)
| Draws a line from the given (x1, y1) location to the given (x2, y2) location |
void |
drawCircle(int x,
int y, int radius)
| Draws an unfilled circle at the given (x, y) location of its top-left corner, with the given radius |
void |
drawOval(int x,
int y, int width, int height)
| Draws an unfilled oval at the given (x, y) location of its top-left corner, with the given width and height |
void |
drawRectangle(int x,
int y, int width, int height)
| Draws an unfilled rectangle at the given (x, y) location of its top-left corner, with the given width and height |
void |
drawString(String str,
int x, int y)
| Draws the given String at the given (x, y) location |
void |
drawString(String str,
int size, int x, int y)
| Draws the given String at the given (x, y) location with the given size |
void |
drawString(String str,
boolean bold, boolean italics, int size, int x,
int y)
| Draws the given String at the given (x, y) location with the given size, and possibly in bold and/or italics |
void |
drawString(String str,
String fontName,
boolean bold, boolean italics, int size, int x,
int y)
| Draws the given String with the given font (ex: "Comic Sans MS") at the given (x, y) location with the given size, and possibly in bold and/or italics |
void |
fillCircle(int x,
int y, int radius)
| Draws a filled circle at the given (x, y) location of its top-left corner, with the given radius |
void |
fillOval(int x,
int y, int width, int height)
| Draws a filled oval at the given (x, y) location of its top-left corner, with the given width and height |
void |
fillRectangle(int x,
int y, int width, int height)
| Draws a filled rectangle at the given (x, y) location of its top-left corner, with the given width and height |
void |
clearDrawing()
| Clears the drawing area |
Color |
brighter(Color color)
| Returns a brighter copy of the given Color |
Color |
darker(Color color)
| Returns a darker copy of the given Color |
int |
getDrawingHeight()
| Returns the height of the drawing area so you know where the drawing areas top (0) and bottom edges (the returned value) are |
int |
getDrawingWidth()
| Returns the width of the drawing area so you know where the drawing areas left (0) and right edges (the returned value) are |
| Miscellaneous |
void |
delay(double seconds)
| Delays the running of your program by the given number of seconds (ex: 3 or .5) |
double |
absoluteValue(double num)
| Returns the absolute value of the given double (ex: if you give it -1.4, it will return 1.4) |
int |
absoluteValue(int num)
| Returns the absolute value of the given double (ex: if you give it -72, it will return 72) |
boolean |
equal(String firstString,
String secondString)
| Test to see if two String values are equal. Note: it is important that you do not use == to test if two Strings are equal |
boolean |
equal(boolean firstBoolean,
boolean secondBoolean)
| Test to see if two boolean values are equal |
boolean |
equal(Color firstColor,
Color secondColor)
| Test to see if two Color values are equal |
boolean |
equal(double firstDouble,
double secondDouble)
| Test to see if two double values are equal |
boolean |
equal(int firstInt,
int secondInt)
| Test to see if two int values are equal |
| Random Values |
boolean |
randomBoolean()
| Returns a random boolean (ex: true or false) |
Color |
randomColor()
| Returns a random Color value (ex: darkSeaGreen) |
double |
randomDouble()
| Returns a random double value between 0 and 1 (ex: 0.614566671372701) |
int |
randomInt()
| Returns a random int value (ex: 709181651) |