Bank management system using java with Swing(GUI)

Introduction
In the modern digital world, managing your banking operations efficiently is critical. This Java-based Bank Management System merges core banking aspects with an ATM system, allowing for administrators, employees, and customers to be in one space. The application is built using Java Swing for the graphical user interface, and MySQL for the data storage. The system is fully functional with account management, transaction management, and live data updates. An added feature is that email notification functionality was added to alert users when accounts are created, or when transactions are made. The email notification enhances user engagement while notifying users of activity. This project can help you to learn how a banking system operates if you are adeveloper or if you are an institution that wants to digitise and old process . This project can serve as a basic foundation.
Admin features
- Login
- Forget password
- Admin have ability to add multiples employees.
- Admin can see how many employees is active.
- Admin can block and activate any employee account.Admin can delete, block or activate any bank accounts or ATM accounts.
- Admin can change his account password.
- And also able to change his profile image.
- Admin can see any account history by searching any account. And also search history of
- any account between two dates.
- Admin can save any account history as PDF file and also save the profile as PNG image.
- There are more many features in project but main features are given.
Employee characteristics
- Login.
- Forgot password.
- Add multiple accounts.
- Able to activate an ATM account on any bank account.
- And Able to block or activate any bank account or ATM account.
- Able to change his account password.
- And also Able to change his profile image.
- Able to see any account history by searching any account. And also search the history of
- any account for any two dates.
- Able to save any account history to a PDF file and can also save the profile as a PNG
- image.
- He could search any account history from start to finish or search from any two dates.
- Create transaction between two accounts.
- Make withdrawal.
- Deposit money.
There are more many features in the project but the main features are given.
Required Modules or packages
In order to operate this project successfully , ensure that the following components are setup:
- Java Development Kit (JDK): Version 8 or higher.
- Eclipse IDE: For Java Developers.
- MySQL Database: Managed via XAMPP.
- Java Swing: To build the GUI.
- JDBC Driver: To connect Java applications to MySQL
How to Run the Code
1. Clone or download the project : git clone https://github.com/meamirghafoor/bank-management-system-with-atm-feature-using-java-gui-interface.git
2. Import your project into eclipse Start your eclipse IDE.
Choose file > import
Select general > existing projects into workspace , and click next.Browse to the project folder (bank management system..) you downloaded.
3. Setup MySQL Database Through XAMPP
Open XAMPP, and start the Apache and MySQL modules.
Open phpMyAdmin by going to:
http://localhost/phpmyadmin
Click import, and up load the SQL file included in the Database folder of the project
(usually something like bank.sql or other).
This will create the necessary tables and populate the sample data in your local MySQL
database.
4. Setup Email (Optional, but advised)
To enable notifications via email for account creation or transactions correct: Open either the email configuration file or email class (probably EmailSender.java or similar). Replace dummy email and password with valid sender email credentials. Ensure that you have enabled “less secure app access” in gmail (or use app passwords if using 2FA).
5. Execute the Application
In Eclipse, browse to the src directory. Find the main Java file, with the file name usually listed as Main.java or BankSystem.java.
Right-click the file and select Run As > Java Application.
6. Engage with the system You will be given a GUI window , within which you will have the ability to : Login as admin or as ATM user . Perform functions such as account creation , withdrawals , deposits, view transaction history , export reports and change passwords.
Get Discount on Top Educational Courses
Code Explanation
Below is the summary of the code’s main elements:
AtmLogin.java : This is the primary starting point for atm users. It shows a login screen for customers to enter their account number and PIN and verifies their credentials against database.
public void actionPerformed(ActionEvent e) {
String acc = txt_acc.getText();
String pin = txt_pin.getText();
String query = "SELECT * FROM atm WHERE acc_no = '"+acc+"' AND pin =
'"+pin+"'";
// If match found, redirect to ATMMainMenu
}
Create account.java : This files handles account creation of new customers. It collects user data through form fields and stores them in the account table in database.
String query = "INSERT INTO accounts (name, address, balance) VALUES (?, ?, ?)";
PreparedStatement ps = conn.prepareStatement(query);
ps.setString(1, name);
ps.setString(2, address);
ps.setDouble(3, initialDeposit);
ps.executeUpdate();
DBConnection.java :Uses JDBC to handle database connectivity. This class is reused across the app for all SQL queries.
public class DBConnection {
public static Connection getConnection() throws SQLException {
return DriverManager.getConnection("jdbc:mysql://localhost:3306/bankdb", "root",
"");
}
}
ATMMainMenu.java : Shows the main menu for ATM users and connects buttons to actions (withdrawal , deposits , mini statement , change pin etc).
JButton withdrawBtn = new JButton("Withdraw");
withdrawBtn.addActionListener(e -> new Withdraw(acc_no).setVisible(true));
Withdraw.java , Deposit,java , Transfer.java : Each of these files deals specifically with a transaction type , construct a custom window with Swing Components and then update the change to the account balance in the database.
String query = "UPDATE accounts SET balance = balance - ? WHERE acc_no = ?";
PreparedStatement ps = conn.prepareStatement(query);
ps.setDouble(1, amount);
ps.setString(2, acc_no);
ps.executeUpdate();
MiniStatement.java : Retrieves and displays the last n transactions of an account and is implemented using table components.
String query = "SELECT * FROM transactions WHERE acc_no = ? ORDER BY date DESC
LIMIT 5”;
changePin.java : Allows users to change their ATM PIN securely after verification.
String query = "UPDATE atm SET pin = ? WHERE acc_no = ?";
EmployeeLogin.java , employeeDashboard.java : Only bank employees use these two
classes to : login , create customer accounts , activate ATM access , process customer
deposits/withdrawal.
AdminLogin.java , AdminDashboard.java : Used by admin users to add or remove emplyoees , view all transaction , export data and view system usage.EmailSender.java : Sends confirmation and/or alert emails upon account creation or large transactions using JavaMail API
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
...
Transport.send(message);