https://github.com/afa-farkhod/mini-calculator
Simple Calculator build with eclipse window builder
https://github.com/afa-farkhod/mini-calculator
desktop-application eclipse-ide java swing-gui windowbuilder
Last synced: 2 months ago
JSON representation
Simple Calculator build with eclipse window builder
- Host: GitHub
- URL: https://github.com/afa-farkhod/mini-calculator
- Owner: afa-farkhod
- License: apache-2.0
- Created: 2023-03-02T06:07:58.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T13:51:08.000Z (over 1 year ago)
- Last Synced: 2025-02-02T01:13:33.125Z (4 months ago)
- Topics: desktop-application, eclipse-ide, java, swing-gui, windowbuilder
- Language: Java
- Homepage:
- Size: 602 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple-Calculator
- Simple Calculator built with Eclipse window builder
![]()
- After optimizing the app, updated image is as following:
![]()
- Made some UI changes, result as following:
![]()
## [Implementation](https://github.com/af4092/Mini-Calculator/blob/main/Mini_Calculator/src/com/Login/OptimizationUI.java)
- `Java Swing` application for a mini calculator. It creates a `GUI window` with various buttons and a text field to perform basic arithmetic calculations.
- Here's a breakdown of the code:
- The class `Optimization` extends `JFrame` to create the main frame for the calculator.
- The constructor sets up the frame by setting its size, title, and default close operation.
- The `contentPane` panel is created and set as the content pane for the frame.
- Various Swing components such as buttons, labels, and text fields are created and added to the content pane.
- Action listeners are added to the buttons to perform specific operations when clicked.
- The `btnPlus`, `btnMinus`, `btnMultiply`, `btnDivide`, and `btnSquare_1` buttons set the `operation` variable to the respective operation symbol (`+`, `-`, `*`, `/`, `xy`).
- The `btnEqual` button calculates the result based on the selected operation and displays it in the text field (`tfNumber`) and a label (`lbCalculation`).
- Other buttons (`btnSqrt`, `btnSquare`, `btnClear`, `btnOne`, `btnTwo`, ..., `btnNine`, `btnZero`) handle specific actions such as square root, square, clearing the text field, and entering numeric values.
- The `Optimization` class represents the main window of the calculator application.- To run this code, we need to have the necessary dependencies for Java Swing and compile and execute the code using a Java development environment.