Skip to content

A lightweight desktop calculator application built using Java Swing and AWT. Handles basic arithmetic operations like addition, subtraction, multiplication, and division

Notifications You must be signed in to change notification settings

mrraul010/java-swing-calculator

Repository files navigation

Java Swing Calculator

A simple, graphical user interface (GUI) calculator application built using Java Swing and AWT. This project was created to understand the basics of Java desktop application development, event handling, and UI layout.

📸 Screenshots

see here!

🚀 Features

  • Basic Arithmetic: Perform Addition (+), Subtraction (-), Multiplication (X), and Division (/).
  • Decimal Support: Handles floating-point calculations.
  • Clear Functionality: A "Clear" button to reset the input.
  • Interactive UI: Built using JFrame, JButton, and JLabel.

🛠️ Technologies Used

  • Language: Java
  • Libraries: javax.swing (for UI components), java.awt (for events and styling).

💻 How to Run

To run this project on your local machine, ensure you have the Java Development Kit (JDK) installed.

  1. Clone the repository (or download the files):

    git clone https://github.com/mrraul010/java-swing-calculator.git
    cd java-swing-calculator
  2. Compile the Java file: Open your terminal or command prompt and run:

    javac calculator.java
  3. Run the application:

    java calculator

📂 Project Structure

  • calculator.java: The main source code containing the logic and UI design.

📝 Learning Outcomes

This project helped in understanding:

  • How to create a JFrame window.
  • Implementing the ActionListener interface to handle button clicks.
  • Using float for mathematical operations.
  • Manual layout management using .setBounds().

🤝 Contributing

Feel free to fork this repository and submit pull requests if you want to improve the design or functionality. I welcome any corrections regarding flaws or logic errors. You are also free to use this code for your own studies or as a base for your own mini-projects.

About

A lightweight desktop calculator application built using Java Swing and AWT. Handles basic arithmetic operations like addition, subtraction, multiplication, and division

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages