Banking System Java Project Report
Banking System Java Project Report
1. Introduction
The Banking System Java Project is a simple application designed to simulate the core
functions of a banking system, allowing users to create accounts, log in, check balance,
deposit, and withdraw funds. This project uses Swing for the graphical user interface
(GUI) and file handling for data persistence. It provides a basic interface for managing
bank accounts, with functionalities such as account creation, user login, transaction
history, and balance tracking.
2. Technology Used
The project is developed using Java programming language and utilizes the following
technologies:
1. Java Swing for GUI components.
2. File I/O operations for data persistence (serialization and deserialization).
3. Collections (HashMap, ArrayList) for storing and managing user data and transactions.
4. Java Event Handling for user interactions like buttons, text fields, and action listeners.
3. System Requirements
To run this project, the following system requirements are necessary:
1. Java Development Kit (JDK) version 8 or higher.
2. Integrated Development Environment (IDE) such as Eclipse or IntelliJ IDEA.
3. Basic understanding of Java programming concepts like classes, methods, and GUI
development.
4. System Functionality
The system is designed to simulate a basic banking system with the following core
functionalities:
1. Account Creation: New users can create accounts with a unique username and
password.
2. Login: Registered users can log in by entering their credentials (username and
password).
3. Deposit: Users can deposit money into their account, and the balance is updated
accordingly.
4. Withdraw: Users can withdraw money from their account, provided they have
sufficient balance.
5. Check Balance: Users can check the current balance of their account at any time.
6. Transaction History: The system tracks all transactions, including deposits and
withdrawals, and displays them in a table.
5.Code
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.table.DefaultTableModel;
import java.io.*;
import java.util.*;
loadUsers();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600, 500);
frame.setLocationRelativeTo(null);
JPanel panel = new JPanel();
lblWelcome.setAlignmentX(Component.CENTER_ALIGNMENT);
buttonPanel.add(btnLogin);
buttonPanel.add(btnCreateAccount);
panel.add(buttonPanel);
frame.add(panel);
frame.setVisible(true);
btnCreateAccount.addActionListener(new ActionListener() {
@Override
createAccountFrame.setSize(400, 300);
createAccountFrame.setLocationRelativeTo(null);
createAccountPanel.add(new JLabel("Username:"));
createAccountPanel.add(tfUsername);
createAccountPanel.add(new JLabel("Password:"));
createAccountPanel.add(pfPassword);
createAccountPanel.add(btnCreate);
createAccountFrame.add(createAccountPanel);
createAccountFrame.setVisible(true);
btnCreate.addActionListener(new ActionListener() {
@Override
} else {
JOptionPane.showMessageDialog(createAccountFrame, "Username
already exists!");
}
}
});
}
});
btnLogin.addActionListener(new ActionListener() {
@Override
loginFrame.setSize(400, 250);
loginFrame.setLocationRelativeTo(null);
loginPanel.add(new JLabel("Username:"));
loginPanel.add(tfUsername);
loginPanel.add(new JLabel("Password:"));
loginPanel.add(pfPassword);
loginFrame.add(loginPanel);
loginFrame.setVisible(true);
btnSubmit.addActionListener(new ActionListener() {
@Override
if (users.containsKey(username)) {
if (account.getPassword().equals(password)) {
currentUsername = username;
} else {
JOptionPane.showMessageDialog(loginFrame, "Incorrect
password.");
}
} else {
JOptionPane.showMessageDialog(loginFrame, "Username does not
exist.");
});
}
});
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setSize(600, 600);
mainFrame.setLocationRelativeTo(null);
gbc.gridy = 0;
panel.add(lblAccountName, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
panel.add(lblBalance, gbc);
gbc.gridx = 1;
panel.add(lblBalanceValue, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
panel.add(lblDeposit, gbc);
gbc.gridx = 1;
panel.add(tfDeposit, gbc);
gbc.gridx = 0;
gbc.gridy = 3;
panel.add(lblWithdraw, gbc);
gbc.gridx = 1;
panel.add(tfWithdraw, gbc);
gbc.gridx = 0;
gbc.gridy = 4;
panel.add(btnDeposit, gbc);
gbc.gridx = 1;
panel.add(btnWithdraw, gbc);
gbc.gridx = 0;
gbc.gridy = 5;
panel.add(btnCheckBalance, gbc);
gbc.gridx = 1;
panel.add(btnLogout, gbc);
gbc.gridx = 0;
gbc.gridy = 6;
gbc.gridwidth = 2;
panel.add(scrollPane, gbc);
btnDeposit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
lblBalanceValue.setText("$" + currentAccount.getBalance());
saveUsers();
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(mainFrame, "Please enter a valid
amount.");
});
btnWithdraw.addActionListener(new ActionListener() {
@Override
try {
currentAccount.withdraw(amount);
lblBalanceValue.setText("$" + currentAccount.getBalance());
updateTransactionHistory("Withdraw", amount,
currentAccount.getBalance());
saveUsers();
} else {
}
}
});
btnCheckBalance.addActionListener(new ActionListener() {
@Override
}
});
btnLogout.addActionListener(new ActionListener() {
@Override
mainFrame.dispose();
currentUsername = "";
}
});
mainFrame.add(panel);
mainFrame.setVisible(true);
}
try {
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream("users.dat"));
out.writeObject(users);
out.close();
try {
in.close();
}
ex.printStackTrace();
}
this.password = password;
this.balance = balance;
return username;
return password;
return balance;
}
this.balance += amount;
transactionHistory.add("Deposit: $" + amount);
return transactionHistory;
6. System Flowchart
6. Code Explanation
The core classes and methods of the project are explained as follows:
1. BankAccount Class: Represents a bank account. It includes methods for depositing,
withdrawing, and checking balance.
2. BankingSystemSwing Class: This is the main class that handles the user interface
(GUI) and business logic, including account creation, login, transaction handling, and
display of transaction history.
3. Event Handlers: ActionListeners are used for handling events like button clicks for
login, deposit, and withdrawal operations.
4. Data Persistence: The user data is serialized and saved in a file (users.dat), ensuring
that data persists even after the application is closed.
7. Conclusion
This Banking System project demonstrates a basic implementation of core banking
functionalities in Java. It serves as a valuable learning tool for those familiarizing
themselves with Java programming and Swing for GUI development. The project is
designed to simulate real-world banking operations while offering a practical example of
data persistence using file I/O operations.
Although the system is basic, it provides a solid foundation for future expansions, and
with enhancements such as better security, advanced features, and a mobile version, the
project has the potential to evolve into a fully functional banking application. By
integrating more advanced technologies and testing methodologies, the system could be
made ready for real-world deployment.
Reference
• Java: The Complete Reference" by Herbert Schildt
• Oracle Java Documentation
• Banking System Design and Implementation(Research Paper)
• W3Schools - Java File Handling