A simple Java Swing GUI application for basic banking operations such as checking balance, depositing, withdrawing, and viewing the previous transaction.
The program simulates a bank account with the following features:
- Display current balance
- Deposit money into the account
- Withdraw money from the account
- View the previous transaction (deposit or withdrawal)
- Exit the application
- Java Development Kit (JDK) 8 or higher
-
BankingApplicationGUI.java: Contains themainmethod that creates aBankAccountobject and launches the GUI. -
BankAccountclass: Implements account logic and builds the Swing GUI:-
Fields:
int balance: current account balanceint previousTransaction: amount of the last transactionString customerName, customerId: customer information
-
GUI Components:
JFrame frame: main application windowJLabel balanceLabel: displays the current balanceJTextField amountField: input for deposit/withdrawal amountsJTextArea outputArea: shows operation results
-
Key Methods:
deposit(int amount): adds funds to the balancewithdraw(int amount): subtracts funds from the balancegetPreviousTransaction(): prints the last transaction detailsupdateBalance(): refreshes the balance labelshowMenu(): constructs and displays the GUI with event handlers
-
-
Save the code in a file named
BankingApplicationGUI.java. -
Open a terminal and navigate to the directory containing the file.
-
Compile:
javac BankingApplicationGUI.java
-
Run:
java BankingApplicationGUI
Below is the actual screenshot of the application interface:
This project is licensed under the MIT License. See the LICENSE file for details.
