A simple yet powerful desktop drawing application built entirely using Java Swing. This project lets users draw, erase, and create basic shapes with customizable colors and brush sizes — a mini version of MS Paint implemented from scratch.
✅ Freehand Drawing (Pencil Tool) – Draw smoothly with adjustable brush size
✅ Eraser Tool – Erase parts of the drawing easily
✅ Shape Tools – Draw rectangles, ovals, and straight lines
✅ Color Picker – Choose any color using the system color chooser
✅ Brush Size Control – Change line thickness from 1px up to 20px
✅ Canvas Management – Clear the canvas or resize it dynamically
✅ Save Artwork – Export your drawing as a .png image
✅ Responsive Design – Canvas auto-adjusts when the window is resized
✅ Clean Modern UI – Organized toolbar and control panel layout
The app uses:
BufferedImageto store and render the drawingGraphics2Dfor drawing lines, shapes, and applying brush strokes- Mouse events (
MouseListener,MouseMotionListener) to track drawing actions - Swing components for UI:
JPanel,JButton,JToggleButton,JComboBox,JColorChooser, and more
| Tool | Description |
|---|---|
| 🖊️ Pencil | Draw freely with the selected color |
| 🧽 Eraser | Erase by drawing with white color |
| ⬛ Rectangle | Draw outlined rectangles |
| ⚪ Oval | Draw outlined circles/ellipses |
| 📏 Line | Draw straight lines between two points |
- Java 8 or higher
- JDK installed and added to your system
PATH - Works on Windows, macOS, and Linux
-
Clone this repository
git clone https://github.com/yourusername/java-paint-app.git cd java-paint-app
-
Compile the Java file
javac PaintApp.java
-
Run the application
java PaintApp
- 🪣 Fill/Bucket tool
🅰️ Text tool- 🌗 Dark mode
- 🖼️ Image import support
- 💾 Auto-save functionality
Akanksha Mane 🎓 B.E. Information Technology