ATM Interface
ATM Interface
java
package atm_interface;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
JButton back;
String pinnumber;
BalanceEnquiry(String pinnumber){
this.pinnumber=pinnumber;
setLayout(null);
add(image);
back.addActionListener(this);
image.add(back);
int balance=0;
try{
while (rs.next()) {
if(rs.getString("type").equals("Deposit")){
balance+=Integer.parseInt( rs.getString("amount"));
}else{
balance -=Integer.parseInt(rs.getString("amount"));
}catch(Exception e){
System.out.println(e);
text.setForeground(Color.WHITE);
image.add(text);
setSize(900,900);
setLocation(300, 0);
//setUndecorated(true);
setVisible(true);
setVisible(false);
new Transactions(pinnumber).setVisible(true);
new BalanceEnquiry("");
Conn.java
package atm_interface;
import java.sql.*;
Statement s;
public Conn(){
try{
c=DriverManager.getConnection("jdbc:mysql:///bankmanagementsystem",
"root","himi211@1234");
s=c.createStatement();
}catch(Exception e){
System.out.println(e);
Deposit.java
package atm_interface;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
JTextField amount;
String pinnumber;
Deposit(String pinnumber){
this.pinnumber=pinnumber;
add(image);
JLabel text =new JLabel("Enter the amount you want to deposit");
text.setForeground(Color.WHITE);
image.add(text);
amount=new JTextField();
image.add(amount);
deposit=new JButton("Deposit");
deposit.addActionListener(this);
image.add(deposit);
back=new JButton("Back");
back.addActionListener(this);
image.add(back);
setSize(900, 900);
setLocation(300,0);
setVisible(true);
if(ae.getSource()==deposit){
String number=amount.getText();
if (number.equals("")){
JOptionPane.showMessageDialog(null, "Please enter the amount you want to deposit");
}else{
try{
conn.s.executeUpdate(query);
setVisible(false);
new Transactions(pinnumber).setVisible(true);
}catch(Exception e){
System.out.println(e);
}else if(ae.getSource()==back){
setVisible(false);
new Transactions(pinnumber).setVisible(true);
new Deposit("");
FastCash.java
package atm_interface;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.Date;
import javax.swing.*;
public class FastCash extends JFrame implements ActionListener {
JButton r1,r2,r3,r4,r5,r6,back;
String pinnumber;
FastCash(String pinnumber){
this.pinnumber=pinnumber;
setLayout(null);
add(image);
text.setForeground(Color.WHITE);
r1.addActionListener(this);
image.add(r1);
r2.addActionListener(this);
image.add(r2);
r3.addActionListener(this);
image.add(r3);
r4.addActionListener(this);
image.add(r4);
r5.addActionListener(this);
image.add(r5);
r6=new JButton("10000");
r6.addActionListener(this);
image.add(r6);
back=new JButton("Back");
back.addActionListener(this);
image.add(back);
setSize(900,900);
setLocation(300, 0);
//setUndecorated(true);
setVisible(true);
setVisible(false);
new Transactions(pinnumber).setVisible(true);
}else {
try{
int balance=0;
while (rs.next()) {
if(rs.getString("type").equals("Deposit")){
balance+=Integer.parseInt( rs.getString("amount"));
}else{
balance -=Integer.parseInt(rs.getString("amount"));
return;
c.s.executeUpdate(query);
setVisible(false);
new Transactions(pinnumber).setVisible(true);
}catch(Exception e){
System.out.println(e);
}
}
new FastCash("");
Login.java
package atm_interface;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
JTextField cardTextField;
JPasswordField pinTextField;
Login(){
setLayout(null);
add(label);
add(cardno);
add(cardTextField);
add(pin);
add(pinTextField);
login.setBackground(Color.darkGray);
login.setForeground(Color.WHITE);
login.addActionListener(this);
add(login);
clear.setForeground(Color.WHITE);
clear.addActionListener(this);
add(clear);
signup.setBackground(Color.darkGray);
signup.setForeground(Color.WHITE);
signup.addActionListener(this);
add(signup);
getContentPane().setBackground(Color.WHITE);
setSize(800, 480);
setVisible(true);
setLocation(350, 200);
if(ae.getSource()==clear){
cardTextField.setText("");
pinTextField.setText("");
}else if(ae.getSource()==login){
try{
ResultSet rs =conn.s.executeQuery(query);
if(rs.next()){
setVisible(false);
new Transactions(pinnumber).setVisible(true);
}else{
}catch(Exception e){
System.out.println(e);
}else if(ae.getSource()==signup){
setVisible(false);
new SignupOne().setVisible(true);
new Login();
package atm_interface;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
MiniStatement(String pinnumber){
setTitle("Mini Statement");
setLayout(null);
add(mini);
add(bank);
add(card);
add(balance);
try{
while (rs.next()) {
}catch(Exception e){
System.out.println(e);
try{
int bal=0;
if(rs.getString("type").equals("Deposit")){
bal+=Integer.parseInt( rs.getString("amount"));
}else{
bal-=Integer.parseInt(rs.getString("amount"));
}catch(Exception e2){
System.out.println(e2);
setSize(400,600);
setLocation(20 , 20);
getContentPane().setBackground(Color.WHITE);
//setUndecorated(true);
setVisible(true);
new MiniStatement("");
PinChange.java
package atm_interface;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
String pinnumber;
PinChange(String pinnumber){
this.pinnumber=pinnumber;
setLayout(null);
add(image);
text.setForeground(Color.WHITE);
image.add(text);
pintext.setForeground(Color.WHITE);
image.add(pintext);
image.add(pin);
JLabel repintext =new JLabel("Re-Enter New PIN:");
repintext.setForeground(Color.WHITE);
image.add(repintext);
image.add(repin);
change.addActionListener(this);
image.add(change);
back.addActionListener(this);
image.add(back);
setSize(900,900);
setLocation(300, 0);
setVisible(true);
if(ae.getSource()==change){
try{
String npin=pin.getText();
String rpin=repin.getText();
if(!npin.equals(rpin)){
return;
if(npin.equals("")){
return;
if(rpin.equals("")){
return;
conn.s.executeUpdate(query1);
conn.s.executeUpdate(query2);
conn.s.executeUpdate(query3);
setVisible(false);
new Transactions(rpin).setVisible(true);
}catch(Exception e){
System.out.println(e);
}else{
setVisible(false);
new Transactions(pinnumber).setVisible(true);;
}
public static void main(String[] args) {
new PinChange("").setVisible(true);
SignupOne.java
package atm_interface;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import com.toedter.calendar.JDateChooser;
import java.awt.event.*;
long random;
JButton next;
JDateChooser dateChooser;
SignupOne(){
setLayout(null);
add(formno);
add(personalDetails);
add(name);
nameTextField=new JTextField();
add(nameTextField);
add(fname);
fnameTextField=new JTextField();
add(fnameTextField);
add(dob);
dateChooser.setForeground(new Color(105,105,105));
add(dateChooser);
add(gender);
male.setBackground(Color.WHITE);
add(male);
female.setBackground(Color.WHITE);
add(female);
genderGroup.add(male);
genderGroup.add(female);
add(email);
emailTextField=new JTextField();
add(emailTextField);
add(marital);
married.setBackground(Color.WHITE);
add(married);
unmarried.setBackground(Color.WHITE);
add(unmarried);
other.setBackground(Color.WHITE);
add(other);
maritalGroup.add(married);
maritalGroup.add(unmarried);
maritalGroup.add(other);
add(address);
addressTextField=new JTextField();
add(addressTextField);
JLabel city =new JLabel("City: ");
add(city);
cityTextField=new JTextField();
add(cityTextField);
add(state);
stateTextField=new JTextField();
add(stateTextField);
add(pincode);
pinTextField=new JTextField();
add(pinTextField);
next.setForeground(Color.WHITE);
next.addActionListener(this);
add(next);
getContentPane().setBackground(Color.WHITE);
setSize(850, 800);
setLocation(350, 10);
setVisible(true);
if(male.isSelected()){
gender="Male";
}else if(female.isSelected()){
gender="Female";
if(married.isSelected()){
marital="Married";
}else if(unmarried.isSelected()){
marital="Unmarried";
}else if(other.isSelected()){
marital="Other";
String address=addressTextField.getText();
String city=cityTextField.getText();
String state=stateTextField.getText();
try{
if(name.equals("")){
}else{
String query ="insert into signup values ('"+formno+"', '"+name+"', '"+fname+"', '"+dob+"',
'"+gender+"', '"+email+"', '"+marital+"', '"+address+"', '"+city+"', '"+pin+"', '"+state+"')";
c.s.executeUpdate(query);
setVisible(false);
new SignupTwo(formno).setVisible(true);
}catch(Exception e){
System.out.println(e);
new SignupOne();
SignupThree.java
package atm_interface;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
JRadioButton r1,r2,r3,r4;
JCheckBox c1,c2,c3,c4,c5,c6,c7;
String formno;
SignupThree(String formno){
this.formno=formno;
setLayout(null);
add(l1);
add(type);
r1.setFont(new Font("Railway",Font.BOLD,16));
r1.setBackground(Color.WHITE);
add(r1);
r2.setFont(new Font("Railway",Font.BOLD,16));
r2.setBackground(Color.WHITE);
add(r2);
r3.setFont(new Font("Railway",Font.BOLD,16));
r3.setBackground(Color.WHITE);
add(r3);
r4.setFont(new Font("Railway",Font.BOLD,16));
r4.setBackground(Color.WHITE);
add(r4);
groupaccount.add(r1);
groupaccount.add(r2);
groupaccount.add(r3);
groupaccount.add(r4);
add(card);
add(number);
JLabel carddetails = new JLabel("Your 16 Digit Card Number");
add(carddetails);
add(pin);
add(pnumber);
add(pindetails);
add(services);
c1.setBackground(Color.WHITE);
c1.setBounds(100,500,200,30);
add(c1);
c2.setBackground(Color.WHITE);
c2.setBounds(350,500,200,30);
add(c2);
c3.setBackground(Color.WHITE);
c3.setBounds(100,550,200,30);
add(c3);
c4.setBackground(Color.WHITE);
c4.setBounds(350,550,200,30);
add(c4);
c5 =new JCheckBox("I Hereby declares that the above entered details are correct");
c5.setBackground(Color.WHITE);
c5.setBounds(100,600,450,30);
add(c5);
submit.setBackground(Color.DARK_GRAY);
submit.setForeground(Color.WHITE);
add(submit);
cancel.setBackground(Color.DARK_GRAY);
cancel.setForeground(Color.WHITE);
cancel.addActionListener(this);
add(cancel);
getContentPane().setBackground(Color.WHITE);
setSize(850,820);
setLocation(350, 0);
setVisible(true);
if(ae.getSource()==submit){
String accountType=null;
if(r1.isSelected()){
accountType="Saving Account";
}else if(r2.isSelected()){
}else if(r3.isSelected()){
accountType="Current Account";
}else if(r4.isSelected()){
if(c1.isSelected()){
}else if(c2.isSelected()){
}else if(c3.isSelected()){
}else if(c4.isSelected()){
try{
if(accountType.equals("")){
}else{
conn.s.executeUpdate(query1);
conn.s.executeUpdate(query2);
setVisible(false);
new Deposit(pinnumber).setVisible(true);
}catch(Exception e){
System.out.println(e);
}
}
else if(ae.getSource()==cancel){
setVisible(false);
new Login().setVisible(true);
new SignupThree("");
SignupTwo.java
package atm_interface;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
JTextField pan,aadhar;
JButton next;
JRadioButton syes,sno,eyes,eno;
String formno;
SignupTwo(String formno){
this.formno=formno;
setLayout(null);
add(additionalDetails);
JLabel religionLabel =new JLabel("Religion: ");
add(religionLabel);
String valReligion[]={"Hindu","Muslim","Sikh","Christian","Other"};
religion.setBackground(Color.WHITE);
add(religion);
add(incomeLabel);
income.setBackground(Color.WHITE);
add(income);
add(educationLabel);
add(qualificationLabel);
String educationValues[]={"Non Graduation","Graduate","Post
Graduation","Doctrate","Others"};
education.setBackground(Color.WHITE);
add(education);
add(occupationLabel);
String occupationValues[]={"Salaried","Self
Employed","Bussiness","Student","Retired","Others"};
occupation.setBackground(Color.WHITE);
add(occupation);
add(panLabel);
pan=new JTextField();
add(pan);
add(aadharLabel);
aadhar=new JTextField();
add(aadhar);
add(citizenLabel);
syes.setBackground(Color.WHITE);
add(syes);
sno.setBackground(Color.WHITE);
add(sno);
maritalGroup.add(syes);
maritalGroup.add(sno);
eyes.setBackground(Color.WHITE);
add(eyes);
eno.setBackground(Color.WHITE);
add(eno);
accountGroup.add(eyes);
accountGroup.add(eno);
next.setBackground(Color.DARK_GRAY);
next.setForeground(Color.WHITE);
next.addActionListener(this);
add(next);
getContentPane().setBackground(Color.WHITE);
setSize(850, 800);
setLocation(350, 10);
setVisible(true);
if(syes.isSelected()){
seniorcitizen="Yes";
}else if(sno.isSelected()){
seniorcitizen="No";
if(eyes.isSelected()){
existingaccount="Yes";
}else if(eno.isSelected()){
existingaccount="No";
String span=pan.getText();
String saadhar=aadhar.getText();
try{
c.s.executeUpdate(query);
setVisible(false);
new SignupThree(formno).setVisible(true);;
}catch(Exception e){
System.out.println(e);
}
new SignupTwo("");
Transactions.java
package atm_interface;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
String pinnumber;
Transactions(String pinnumber){
this.pinnumber=pinnumber;
setLayout(null);
add(image);
text.setForeground(Color.WHITE);
deposit.addActionListener(this);
image.add(deposit);
withdrawl.addActionListener(this);
image.add(withdrawl);
fastcash.addActionListener(this);
image.add(fastcash);
ministatement.addActionListener(this);
image.add(ministatement);
pinchange.addActionListener(this);
image.add(pinchange);
balanceenquiry.addActionListener(this);
image.add(balanceenquiry);
exit=new JButton("Exit");
exit.setBounds(355, 520, 150, 30);
exit.addActionListener(this);
image.add(exit);
setSize(900,900);
setLocation(300, 0);
//setUndecorated(true);
setVisible(true);
if(ae.getSource()==exit){
System.exit(0);
}else if(ae.getSource()==deposit){
setVisible(false);
new Deposit(pinnumber).setVisible(true);
}else if(ae.getSource()==withdrawl){
setVisible(false);
new Withdrawl(pinnumber).setVisible(true);
}else if(ae.getSource()==fastcash){
setVisible(false);
new FastCash(pinnumber).setVisible(true);;
}else if(ae.getSource()==pinchange){
setVisible(false);
new PinChange(pinnumber).setVisible(true);
}else if(ae.getSource()==balanceenquiry){
setVisible(false);
new BalanceEnquiry(pinnumber).setVisible(true);
}else if(ae.getSource()==ministatement){
new MiniStatement(pinnumber).setVisible(true);
}
}
new Transactions("");
Withdrawl.java
package atm_interface;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
JTextField amount;
String pinnumber;
Withdrawl(String pinnumber){
this.pinnumber=pinnumber;
add(image);
text.setForeground(Color.WHITE);
image.add(text);
amount=new JTextField();
amount.setFont(new Font("Railway", Font.BOLD, 22));
image.add(amount);
withdraw=new JButton("withdraw");
withdraw.addActionListener(this);
image.add(withdraw);
back=new JButton("Back");
back.addActionListener(this);
image.add(back);
setSize(900, 900);
setLocation(300,0);
setVisible(true);
if(ae.getSource()==withdraw){
String number=amount.getText();
if (number.equals("")){
}else{
try{
conn.s.executeUpdate(query);
new Transactions(pinnumber).setVisible(true);
}catch(Exception e){
System.out.println(e);
}else if(ae.getSource()==back){
setVisible(false);
new Transactions(pinnumber).setVisible(true);
new Withdrawl("");
There are some java files are BalanceEnquiry.java, Conn.java, Deposit.java, FastCash.java, Login.java,
MiniStatement.java, PinChange.java, SignupOne.java, SignupThree.java, SignupTwo.java,
Transaction.java, Withdrawl.java So you have create Transfer.java file using gui interface according to
above java files code , which include money transfer between two person and also state query to
update data in database table