An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

# Simple-Calculator
- Simple Calculator built with Eclipse window builder


Image

- After optimizing the app, updated image is as following:


Image

- Made some UI changes, result as following:


Image

## [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.