For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started

Starter Template and an Example Program for javaDraw

Now that we have javaDraw installed, we can write a base program:

import javadraw.*;

public class Program extends Window {
    
    public static void main(String[] args) {
        Window.open();
    }
    
    public void start() {
        // Code goes here!    
    }
    
}

Note that animation is as simple as adding a while loop to the start method!

boolean running = true;
boolean fps = 30;

while (running) {
    screen.update();
    screen.sleep(1 / fps);
}

Example Program

Now we can go ahead and add some shapes:

And it should produce the following program output:

Last updated