Package codedraw

Class CodeDraw

java.lang.Object
codedraw.Image
codedraw.CodeDraw
All Implemented Interfaces:
AutoCloseable

public class CodeDraw extends Image implements AutoCloseable
CodeDraw is a beginner-friendly drawing library which can be used to create pictures, animations and even interactive applications. It is designed for people who are just starting to learn programming, enabling them to create graphical applications.

Read the Introduction to CodeDraw for a beginners guide to CodeDraw. It also gives an overview of the features available in CodeDraw.

The JavaDoc for CodeDraw can be found here.

Here is an example to get you started:

 import codedraw.*;

 public class MyProgram {
     public static void main(String[] args) {
         // Creates a new CodeDraw window with the size of 600x600 pixel.
         CodeDraw cd = new CodeDraw();

         // Sets the drawing color to red.
         cd.setColor(Palette.RED);
         // Draws the outline of a rectangle.
         cd.drawRectangle(100, 100, 200, 100);
         // Draws a filled Square.
         cd.fillSquare(180, 150, 80);

         // Changes the color to light blue.
         cd.setColor(Palette.LIGHT_BLUE);
         cd.fillCircle(300, 200, 50);

         // Finally, the method cd.show() must be called
         // to display the drawn shapes in the CodeDraw window.
         cd.show();
     }
 }
 
Fun Fact: You can copy the currently displayed canvas to your clipboard by pressing Ctrl + C