The Shape Drawer Application is a Java-based desktop program that allows users to draw various shapes with customizable dimensions and colors. This interactive tool provides a user-friendly interface for creating and visualizing simple geometric shapes.
- Draw multiple shapes: Rectangle, Square, Circle, and Triangle
- Real-time shape preview
- Customizable shape dimensions using sliders
- Color selection for shapes
- Centered shape display in both preview and main drawing areas
- Language: Java
- GUI Framework: Swing
- Build Tool: Maven
ShapeDrawerApp/
├── src/
│ └── main/
│ └── java/
│ └── com/
│ └── mycompany/
│ └── shapedrawerapp/
│ ├── ShapeDrawerApp.java
│ ├── ShapePanel.java
│ ├── Shape.java
│ ├── Rectangle.java
│ ├── Square.java
│ ├── Circle.java
│ └── Triangle.java
└── pom.xml
ShapeDrawerApp
: Main application class that sets up the GUI and handles user interactions.ShapePanel
: Custom JPanel for drawing shapes.Shape
: Interface defining the common methods for all shapes.Rectangle
,Square
,Circle
,Triangle
: Classes implementing the Shape interface for specific shapes.
- Run the application.
- Select a shape using the radio buttons on the right panel.
- Adjust the shape's dimensions using the sliders.
- Click the "Choose Color" button to select a color for your shape.
- The preview panel will update in real-time as you make changes.
- Click the "Draw Shape" button to finalize the shape on the main drawing area.
To build and run the project:
- Ensure you have Java JDK 8 or higher and Maven installed.
- Navigate to the project root directory.
- Run
mvn clean install
to build the project. - Run
java -jar target/shapedrawerapp-1.0-SNAPSHOT.jar
to start the application.
To further develop or modify this application:
- Import the project into your preferred Java IDE (e.g., NetBeans, IntelliJ IDEA, Eclipse).
- The
ShapeDrawerApp
class is the main entry point and contains the GUI setup. - To add new shapes:
- Create a new class implementing the
Shape
interface. - Add the shape to the shape selection options in
ShapeDrawerApp
. - Implement the drawing logic in the new shape class.
- Create a new class implementing the
- Add more complex shapes (e.g., pentagon, hexagon)
- Implement shape rotation
- Allow multiple shapes on the canvas
- Add undo/redo functionality
- Implement save/load features for created drawings
Contributions to the Shape Drawer Application are welcome! Please feel free to submit pull requests or create issues for bugs and feature requests.
This project is open source and available under the MIT License.