An interactive geometric shape drawing and calculation application developed with Java Swing.
Geometry Drawer is a desktop application that allows users to draw basic geometric shapes like circles, squares, and triangles, and instantly calculate their area and perimeter. With its user-friendly graphical interface, it's an ideal tool for visualizing geometric concepts and performing quick calculations.
- Interactive Drawing: Users can draw shapes directly on the canvas using the mouse.
- Instant Calculations: The area and perimeter of each drawn shape are automatically calculated and displayed.
- Variety of Shapes: Ability to draw circles, squares, and triangles.
- User-Friendly Interface: An intuitive and clean interface designed with Java Swing.
Setting up and running this project on your local machine is quite straightforward.
- Java Development Kit (JDK) 8 or newer: Required to compile and run the project.
-
Clone the Repository: First, download the project's source code to your computer. Open your terminal (Mac/Linux) or Command Prompt/PowerShell (Windows) and run the following command:
git clone https://github.com/ItsMerad/Geometry-Drawer.git
-
Navigate to the Project Folder: Change your current directory to the main project folder you just cloned:
cd Geometry-Drawer -
Compile the Source Code: You need to compile the
.javasource files to create.classfiles. We'll compile all Java files located in thesrc/Geometry_Drawer/directory:javac -d out src/Geometry_Drawer/*.java -
Run the Application: After compilation is complete, you can run the application via its main class. The main class for this application is likely
Geometry_Drawer.GeometryDrawer.java -cp out Geometry_Drawer.GeometryDrawer
-cp out: Specifies that compiled.classfiles are in theoutdirectory.Geometry_Drawer.GeometryDrawer: The fully qualified name of your main class (including its package).
This project was primarily developed using the following tools:
- Java
- Java Swing (for the graphical user interface)
- Git (for version control)
- Visual Studio Code (as the primary development environment)
Developing the Geometry Drawer application was an insightful journey that solidified my understanding of several key programming concepts and best practices:
- Mastering Java Swing: Gained practical experience in designing and implementing interactive graphical user interfaces (GUIs) using Swing components, including event handling for user interactions like drawing on a canvas.
- Object-Oriented Design (OOD) in Practice: Applied OOD principles to model geometric shapes (
Circle,Square,Triangle) as distinct objects, inheriting from a commonShapeinterface or abstract class to manage their properties and behaviors (e.g., calculating area and perimeter). - Understanding Compilation and Execution: Reinforce my knowledge of the Java compilation process (
javac) and how to execute Java applications from the command line, including managing class paths. - Version Control Workflow: Further practiced essential Git commands such as
add,commit, andpush, deepening my understanding of version control for tracking project evolution.
The main directory structure of the project is as follows:
Geometry-Drawer/
├── out/ # Compiled Java .class files
│ └── Geometry_Drawer/
│ ├── Circle.class
│ ├── GeometryDrawer$1.class
│ ├── GeometryDrawer$2.class
│ ├── GeometryDrawer$3.class
│ ├── GeometryDrawer.class
│ ├── Point.class
│ ├── Shape.class
│ ├── Square.class
│ └── Triangle.class
└── src/ # Main source code of the project
└── Geometry_Drawer/
├── Circle.java
├── GeometryDrawer.java # Main application class
├── Point.java
├── Shape.java
├── Square.java
└── Triangle.java
Contributions are welcome! If you find a bug, want to add a new feature, or have any suggestions for improvement, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.
- GitHub: ItsMerad