Java Language

Example:
public class MyFile
{
  public static void drawBox()
  {
    Draw.window(600, 400);
    Draw.setTitle("My Drawing #1");
    Draw.setColor(255, 255, 0);
    Draw.setFill(true);
    Draw.rectangle(100, 100, 400, 200);
    Draw.setColor(0, 0, 0);
    Draw.text(300, 200, "Hello");
  }
}
Rules:

file public class { method-declaration ... }
method-declaration public static return-type method-name() { statement ... }
statement file-name.method-name();

System.out.println(expression);

if (boolean-expression)
{
statements }
else
{
statements }

return expression;

while (boolean-expression)
{
statements }

variable = expression;

type variable;


Integer

Example:
int answer;
answer = Integer.parseInt("42");
Methods:

int parseInt(String textWithNumber)


Util

Example:
int yourNum;
int myNum;
System.out.println("You pick a number");
yourNum = Integer.parseInt(Util.input());
myNum = Util.random(1, 10);
System.out.println("I picked the number " + myNum);
Methods:

String input()
void pause(int seconds)
int random(int low, int high) //from low to high inclusive


Draw

Example:
Draw.window(600, 400); //600 pixels wide, 400 pixels tall
Draw.setTitle("My Drawing #1");
Draw.setColor(255, 255, 0); //yellow
Draw.setFill(true);
Draw.rectangle(100, 100, 400, 200); //top left at (100, 100)
Draw.setColor(0, 0, 0); //black
Draw.text(300, 200, "Hello"); //centered at (300, 200)

Methods:

void window(int width, int height)
void setTitle(String title)
void setColor(int red, int green, int blue)
void setFill(boolean shouldFill)
void setFont(int size)
void line(int x1, int y1, int x2, int y2)
void rectangle(int x, int y, int width, int height)
void oval(int x, int y, int width, int height)
void polygon(int x1, int y1, int x2, int y2, int x3, int y3 ... )
void text(int x, int y, String text)
void image(int x, int y, int width, int height, String fileName)
void pauseUntilMouse()
int getMouseX()
int getMouseY()


Grid

Example:
int x;
int y;
Grid.window("mypicture.jpg");
x = 0;
while (x < Grid.getWidth())
{
  y = 0;
  while (y < Grid.getHeight())
  {
    Grid.setColor(x, y, Grid.getRed(x, y), 0, 0);
    y = y + 1;
  }
  x = x + 1;
}
Methods:

void window(int width, int height)
void window(String imageFileName)
int getWidth()
int getHeight()
int getRed(int x, int y)
int getGreen(int x, int y)
int getBlue(int x, int y)
void setColor(int x, int y, int red, int green, int blue)
String getImage(int x, int y) //"" if empty
void setImage(int x, int y, String imageFileName) //"" to remove image
int getMouseX()
int getMouseY()


Robot

Example:
public static void turnAround()
{
  Robot.turnLeft();
  Robot.turnLeft();
}
Methods:

void move()
void turnLeft()
void makeLight()
void makeDark()
boolean onDark()
boolean frontIsClear()