This project is a basic calculator application built using Java Swing for the graphical user interface (GUI). It supports basic arithmetic operations including addition, subtraction, multiplication, and division.
- Basic arithmetic operations: addition, subtraction, multiplication, and division
- Clear button to reset the input
- Delete button to remove the last digit
- Support for decimal numbers
- Toggle for negative numbers
To run this project, you need to have Java Development Kit (JDK) installed on your machine.
-
Clone the repository to your local machine:
git clone https://github.com/MKmasterg/SwingCalculator
-
Compile the Java source file:
javac Main.java
-
Run the application:
java Main
In the bottom panel we have some operations which are :
- The
CLR
button that clears the input field. - The
DEL
button that deletes the last entered digit. - The
-
button that toggles the sign of the current input.
Main.java
: The main class that sets up the JFrame and handles all the button actions.MathComplex
: A nested static class withinMain
that manages the arithmetic operations (like operand handling) and their states.
If you would like to contribute to this project, please fork the repository and submit a pull request. Contributions are welcome!
This is a part of the Advanced Programming course assignment at Amirkabir University of Technology.