AWTCalculator is a simple yet powerful calculator application built using Java's Abstract Window Toolkit (AWT). It provides a user-friendly graphical interface for performing basic and advanced arithmetic operations. The application demonstrates the use of various AWT GUI components and event handling mechanisms in Java.
- Basic Arithmetic: Addition, subtraction, multiplication, division
- Advanced Operations: Percentage, square root, negative mark
- Clear Function: Reset all input and output fields
- Decimal Support: Input and calculation with floating-point numbers
- Theme Switching: Light and Dark mode for better user experience
- Responsive UI: Layout adapts to different screen sizes
- Keyboard & Mouse Support: All operations accessible via mouse clicks
- Java AWT: For GUI components (Frame, Panel, Button, TextField, MenuBar, etc.)
- Event Handling: Uses
ActionListener
andWindowAdapter
for user interaction - Singleton Pattern: Ensures a single instance of the calculator logic
- Custom Styling: Colors, fonts, and layout for modern look
-
Clone the repository:
git clone https://github.com/cusaldmsr/AWTCalculator.git cd AWTCalculator
-
Build the project:
- Using NetBeans/IDE: Open the project and click "Build".
- Using Ant (from terminal):
ant jar
-
Run the application:
- From IDE: Click "Run".
- From terminal:
java -jar dist/AWTCalculator.jar
- Click the number buttons to enter values.
- Use arithmetic operator buttons (
+
,-
,×
,÷
) for calculations. - Press
=
to get the result. - Use
C
to clear the current input. - Use
√
for square root,%
for percentage, and+/-
to toggle negative values. - Switch between Light and Dark mode from the "View" menu.
src/gui/Calculator.java
: Main application logic and GUIsrc/gui/cal
: Singleton class handling calculator operationsResources/
: Images for UI previews and contributors
- ActionListener: Handles button clicks and menu selections
- WindowAdapter: Handles window closing event
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
See SECURITY.md for supported versions and vulnerability reporting.
This project is licensed under the MIT License.
![]() Cusaldmsr |
![]() Cusaldmzr |
Full Changelog: https://github.com/cusaldmsr/AWTCalculator/commits/v1.0.0
For any questions or issues, please open an issue on GitHub or contact the contributors directly.