A drawing board is a kind of desk which can be used for any kind of drawing, writing or sketching on a sheet of paper. This program, console drawing board, is a Java program that provide a console interface and enable you to draw several figures, including rectangles and triangles.
ScreenManager (sm) which manages and plots the figures of the drawing board
ConsoleBoard.java starts from running an infinite loop that waits for user input. There are 5 functions:
Drawing: the user can draw a rectangle by specifying the width, height, the center of x, and the center of y or a triangle by providing the three vertices.
Erasing: the user can erase any drawn figure.
Centering: the user can center any drawn figure.
Example: there is a robot thread that trigger key board events to show the exmaple usage of this program.
Exit: exit this program
ScreenManager keeps the information of the drawn Figure in an ArrayListfgs on the drawing board and the information of the grid in an array db with the size of 50 * 50.
Figure.java is the parent class of different kind of figures, including Rectangle and Triangle. It defines four abstract functions:
Drawing
Erasing
Centering
Detail
Demonstration
Conclusion
This simple console board drawing program can provide a basic template for more sophisticated console plotting program.