Console Drawing Board is a Java program that provides a console interface and draws figures:
- Drawing rectangles and triangles in a 50 * 50 grid
- Erase any drawn figure
- Center any drawn figure
You can add more figures and functions by modifying the code.
- At the start of the program, you can either enter 1 to draw a rectangle or a triangle or perform a sequence of example including drawing, erasing, and centering.
- After entering 1 to draw, you can draw a rectangle (enter 1) and specify the weight, height, and the center of this rectangle.
- After entering 1 to draw, you can draw a triangle (enter 2) and specify the locations of three vertices.
- To erase a triangle, enter 2 and then enter the number of a triange (2 in this case).
- To center a rectangle, enter 3 and then enter the number of a rectangle (1 in this case).
- To exit the console, enter 5.
This project is built in Eclipse. The process of importing this project into Eclipse is below.
- Open Eclipse
- File -> New -> Java Project -> Enter project name as ConsoleDrawingBoard
- Uncheck the checkbox of use default location -> select the folder of the cloned repository -> Finish
- Open this project
- Click on src -> default packge
- Select ConsoleBoard.java and right click -> Run as 1.Java Application
- Enter 4 to perform the example usage of this drawing board
It will launch a thread to trigger keyboard events to- create a rectangle
- create a triangle
- erase a triangle
- create a triangle
- create a rectangle
- center a rectangle
- center a triangle
- center a rectangle
- delete a rectangle
- delete a triangle
- delete a rectangle
- exit the console
Here is a youtube video shown how to open this program in Eclipse.
Detailed descrptions about this program is in this blog post Console Drawing Board.