A First Look at Graphics with the Breadboards Library

The Breadboards library provides a simple way to write java programs with graphical outputs. Breadboard graphics programs can be thought of as functioning much like a felt board, where various shapes can be "stuck to the board". The Breadboard library come with several basic shapes, each of which is represented by a class (whose name is shown in parentheses below):

Just as an example, the program given at the bottom of the page draws the following to the graphics window when run and the button labeled "Btn1" is pressed:

import java.awt.Color;

import breadboards.Breadboard;
import breadboards.GOval;
import breadboards.GRect;

public class SimpleDrawer extends Breadboard {
    
    public void onButton1Click() {

        GOval oval = new GOval (175,100,150,150);
        oval.setFilled(true);
        oval.setFillColor(Color.RED);
        this.add(oval);
           

        GRect rect = new GRect(290,120,50,50);
        rect.setFilled(true);
        rect.setFillColor(Color.BLUE);
        this.add(rect);
    }       

    public static void main(String[] args) {
        SimpleDrawer simpleDrawer = new SimpleDrawer();
        simpleDrawer.getTextArea().setText("Click Button 1!");
    }
}