0% found this document useful (0 votes)
12 views

ATM Interface

Uploaded by

himanshidalal74
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

ATM Interface

Uploaded by

himanshidalal74
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 42

BalanceEnquiry.

java

package atm_interface;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

public class BalanceEnquiry extends JFrame implements ActionListener{

JButton back;

String pinnumber;

BalanceEnquiry(String pinnumber){

this.pinnumber=pinnumber;

setLayout(null);

ImageIcon i1=new ImageIcon(ClassLoader.getSystemResource("icons/atmlogo.jpg"));

Image i2=i1.getImage().getScaledInstance(900, 900, Image.SCALE_DEFAULT);

ImageIcon i3=new ImageIcon(i2);

JLabel image=new JLabel(i3);

image.setBounds(0, 0, 900, 900);

add(image);

back =new JButton("Back");

back.setBounds(355, 520, 150, 30);

back.addActionListener(this);

image.add(back);

Conn c=new Conn();

int balance=0;

try{

ResultSet rs=c.s.executeQuery("select * from bank where pin = '"+pinnumber+"'");

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);

JLabel text =new JLabel("Your Current Account balance is Rs "+ balance);

text.setForeground(Color.WHITE);

text.setBounds(170, 300, 400, 30);

image.add(text);

setSize(900,900);

setLocation(300, 0);

//setUndecorated(true);

setVisible(true);

public void actionPerformed(ActionEvent ae){

setVisible(false);

new Transactions(pinnumber).setVisible(true);

public static void main(String[] args) {

new BalanceEnquiry("");

Conn.java

package atm_interface;

import java.sql.*;

public class Conn {


Connection c;

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.*;

public class Deposit extends JFrame implements ActionListener{

JTextField amount;

JButton deposit, back;

String pinnumber;

Deposit(String pinnumber){

this.pinnumber=pinnumber;

ImageIcon i1=new ImageIcon(ClassLoader.getSystemResource("icons/atmlogo.jpg"));

Image i2=i1.getImage().getScaledInstance(900, 900, Image.SCALE_DEFAULT);

ImageIcon i3=new ImageIcon(i2);

JLabel image=new JLabel(i3);

image.setBounds(0, 0, 900, 900);

add(image);
JLabel text =new JLabel("Enter the amount you want to deposit");

text.setBounds(170, 300, 400, 20);

text.setForeground(Color.WHITE);

text.setFont(new Font("System", Font.BOLD, 16));

image.add(text);

amount=new JTextField();

amount.setFont(new Font("Railway", Font.BOLD, 22));

amount.setBounds(170, 350, 320, 25);

image.add(amount);

deposit=new JButton("Deposit");

deposit.setBounds(355, 485, 150, 30);

deposit.addActionListener(this);

image.add(deposit);

back=new JButton("Back");

back.setBounds(355, 520, 150, 30);

back.addActionListener(this);

image.add(back);

setSize(900, 900);

setLocation(300,0);

setVisible(true);

public void actionPerformed(ActionEvent ae){

if(ae.getSource()==deposit){

String number=amount.getText();

Date date=new Date();

if (number.equals("")){
JOptionPane.showMessageDialog(null, "Please enter the amount you want to deposit");

}else{

try{

Conn conn=new Conn();

String query="insert into bank values ('"+pinnumber+"', '"+date+"', 'Deposit',


'"+number+"')";

conn.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Rs "+number+" Deposited Successfully");

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);

public static void main(String[] args) {

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);

ImageIcon i1=new ImageIcon(ClassLoader.getSystemResource("icons/atmlogo.jpg"));

Image i2=i1.getImage().getScaledInstance(900, 900, Image.SCALE_DEFAULT);

ImageIcon i3=new ImageIcon(i2);

JLabel image=new JLabel(i3);

image.setBounds(0, 0, 900, 900);

add(image);

JLabel text =new JLabel("SELECT WITHDRAWL AMOUNT");

text.setBounds(225, 300, 760, 35);

text.setForeground(Color.WHITE);

text.setFont(new Font("System", Font.BOLD, 16));

image.add(text);//add text on image

r1=new JButton("Rs 100");

r1.setBounds(170, 415, 150, 30);

r1.addActionListener(this);

image.add(r1);

r2=new JButton("Rs 500");

r2.setBounds(355, 415, 150, 30);

r2.addActionListener(this);

image.add(r2);

r3=new JButton("Rs 1000");


r3.setBounds(170, 450, 150, 30);

r3.addActionListener(this);

image.add(r3);

r4=new JButton("Rs 2000");

r4.setBounds(355, 450, 150, 30);

r4.addActionListener(this);

image.add(r4);

r5=new JButton("Rs 5000");

r5.setBounds(170, 485, 150, 30);

r5.addActionListener(this);

image.add(r5);

r6=new JButton("10000");

r6.setBounds(355, 485, 150, 30);

r6.addActionListener(this);

image.add(r6);

back=new JButton("Back");

back.setBounds(355, 520, 150, 30);

back.addActionListener(this);

image.add(back);

setSize(900,900);

setLocation(300, 0);

//setUndecorated(true);

setVisible(true);

public void actionPerformed(ActionEvent ae){


if(ae.getSource()==back){

setVisible(false);

new Transactions(pinnumber).setVisible(true);

}else {

String amount =((JButton)ae.getSource()).getText().substring(3);

Conn c=new Conn();

try{

ResultSet rs=c.s.executeQuery("select * from bank where pin = '"+pinnumber+"'");

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"));

if(ae.getSource() != back && balance < Integer.parseInt(amount)){

JOptionPane.showMessageDialog(null, "Insufficient Balance");

return;

Date date =new Date();

String query= "insert into bank values('"+pinnumber+"', '"+date+"', 'Withdrawl',


'"+amount+"')";

c.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Rs"+ amount +" Debited Sccessfully");

setVisible(false);

new Transactions(pinnumber).setVisible(true);

}catch(Exception e){

System.out.println(e);

}
}

public static void main(String[] args) {

new FastCash("");

Login.java

package atm_interface;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class Login extends JFrame implements ActionListener {

JButton login, clear, signup;

JTextField cardTextField;

JPasswordField pinTextField;

Login(){

setTitle("AUTOMATED TELLER MACHINE");

setLayout(null);

ImageIcon i1=new ImageIcon(ClassLoader.getSystemResource("icons/logo.jpg"));

Image i2 = i1.getImage().getScaledInstance(100, 100, Image.SCALE_DEFAULT);

ImageIcon i3 =new ImageIcon(i2);

JLabel label=new JLabel(i3);//use for place image on frame

label.setBounds(70, 10, 100, 100);

add(label);

JLabel text =new JLabel("Welcome to ATM");

text.setFont(new Font("Osward", Font.BOLD, 38));

text.setBounds(200, 40, 450, 40);


add(text);

JLabel cardno =new JLabel("Card No:");

cardno.setFont(new Font("Osward", Font.BOLD, 28));

cardno.setBounds(125, 150, 375, 30);

add(cardno);

cardTextField =new JTextField();

cardTextField.setBounds(300, 150, 230, 30);

cardTextField.setFont(new Font("Arial", Font.BOLD, 16));

add(cardTextField);

JLabel pin =new JLabel("PIN:");

pin.setFont(new Font("Osward", Font.BOLD, 28));

pin.setBounds(125, 220, 375, 30);

add(pin);

pinTextField =new JPasswordField();

pinTextField.setBounds(300, 220, 230, 30);

pinTextField.setFont(new Font("Arial", Font.BOLD, 16));

add(pinTextField);

login =new JButton("SIGN IN");

login.setBounds(300, 300, 100, 30);

login.setBackground(Color.darkGray);

login.setForeground(Color.WHITE);

login.addActionListener(this);

add(login);

clear =new JButton("CLEAR");

clear.setBounds(430, 300, 100, 30);


clear.setBackground(Color.darkGray);

clear.setForeground(Color.WHITE);

clear.addActionListener(this);

add(clear);

signup =new JButton("SIGN UP");

signup.setBounds(300, 350, 230, 30);

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);

public void actionPerformed(ActionEvent ae){

if(ae.getSource()==clear){

cardTextField.setText("");

pinTextField.setText("");

}else if(ae.getSource()==login){

Conn conn=new Conn();

String cardnumber =cardTextField.getText();

String pinnumber= pinTextField.getText();

String query="select * from login where cardnumber='"+cardnumber+"' and


pin='"+pinnumber+"'";

try{

ResultSet rs =conn.s.executeQuery(query);
if(rs.next()){

setVisible(false);

new Transactions(pinnumber).setVisible(true);

}else{

JOptionPane.showMessageDialog(null, "Incorrect Card Number or Pin");

}catch(Exception e){

System.out.println(e);

}else if(ae.getSource()==signup){

setVisible(false);

new SignupOne().setVisible(true);

public static void main(String[] args) {

new Login();

package atm_interface;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

public class MiniStatement extends JFrame{

MiniStatement(String pinnumber){

setTitle("Mini Statement");

setLayout(null);

JLabel mini=new JLabel();


mini.setBounds(20,140,400,200);

add(mini);

JLabel bank=new JLabel("Canara Bank");

bank.setBounds(150, 20, 100, 20);

add(bank);

JLabel card=new JLabel();

card.setBounds(20, 80, 300, 20);

add(card);

JLabel balance=new JLabel();

balance.setBounds(20, 400, 300, 20);

add(balance);

try{

Conn conn=new Conn();

ResultSet rs= conn.s.executeQuery("select * from login where pin ='"+pinnumber+"'");

while (rs.next()) {

card.setText("Card Number: "+


rs.getString("cardnumber").substring(0,4)+"XXXXXXXX"+rs.getString("cardnumber").substring(12));//
from help of this we can insert value in label

}catch(Exception e){

System.out.println(e);

try{

Conn conn=new Conn();

int bal=0;

ResultSet rs= conn.s.executeQuery("select * from bank where pin ='"+pinnumber+"'");


while (rs.next()) {

mini.setText(mini.getText()+ "<HTML>" +rs.getString("date") +


"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + rs.getString("type") +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + rs.getString("amount") +"<br><br><HTML>");

if(rs.getString("type").equals("Deposit")){

bal+=Integer.parseInt( rs.getString("amount"));

}else{

bal-=Integer.parseInt(rs.getString("amount"));

balance.setText("Your current account balance is Rs "+bal);

}catch(Exception e2){

System.out.println(e2);

setSize(400,600);

setLocation(20 , 20);

getContentPane().setBackground(Color.WHITE);

//setUndecorated(true);

setVisible(true);

public static void main(String[] args) {

new MiniStatement("");

PinChange.java

package atm_interface;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class PinChange extends JFrame implements ActionListener{


JPasswordField pin, repin;

JButton change, back;

String pinnumber;

PinChange(String pinnumber){

this.pinnumber=pinnumber;

setLayout(null);

ImageIcon i1=new ImageIcon(ClassLoader.getSystemResource("icons/atmlogo.jpg"));

Image i2=i1.getImage().getScaledInstance(900, 900, Image.SCALE_DEFAULT);

ImageIcon i3=new ImageIcon(i2);

JLabel image=new JLabel(i3);

image.setBounds(0, 0, 900, 900);

add(image);

JLabel text =new JLabel("CHANGE YOUR PIN");

text.setBounds(250, 300, 500, 35);

text.setForeground(Color.WHITE);

text.setFont(new Font("System", Font.BOLD, 16));

image.add(text);

JLabel pintext =new JLabel("New PIN:");

pintext.setBounds(165, 340, 180, 25);

pintext.setForeground(Color.WHITE);

pintext.setFont(new Font("System", Font.BOLD, 16));

image.add(pintext);

pin= new JPasswordField();

pin.setFont(new Font("Railway", Font.BOLD, 25));

pin.setBounds(330, 340, 180, 25);

image.add(pin);
JLabel repintext =new JLabel("Re-Enter New PIN:");

repintext.setBounds(165, 390, 180, 25);

repintext.setForeground(Color.WHITE);

repintext.setFont(new Font("System", Font.BOLD, 16));

image.add(repintext);

repin= new JPasswordField();

repin.setFont(new Font("Railway", Font.BOLD, 25));

repin.setBounds(330, 390, 180, 25);

image.add(repin);

change =new JButton("CHANGE");

change.setBounds(355, 485, 150, 30);

change.addActionListener(this);

image.add(change);

back =new JButton("BACK");

back.setBounds(355, 520, 150, 30);

back.addActionListener(this);

image.add(back);

setSize(900,900);

setLocation(300, 0);

setVisible(true);

public void actionPerformed(ActionEvent ae){

if(ae.getSource()==change){

try{

String npin=pin.getText();

String rpin=repin.getText();
if(!npin.equals(rpin)){

JOptionPane.showMessageDialog(null, "Entered PIN does not match");

return;

if(npin.equals("")){

JOptionPane.showMessageDialog(null, "Please enter new PIN");

return;

if(rpin.equals("")){

JOptionPane.showMessageDialog(null, "Please re-enter PIN");

return;

Conn conn=new Conn();

String query1="update bank set pin='"+rpin+"' where pin ='"+pinnumber+"'";

String query2="update login set pin='"+rpin+"' where pin ='"+pinnumber+"'";

String query3="update signupthree set pin='"+rpin+"' where pin ='"+pinnumber+"'";

conn.s.executeUpdate(query1);

conn.s.executeUpdate(query2);

conn.s.executeUpdate(query3);

JOptionPane.showMessageDialog(null, "PIN changed successfully");

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.*;

public class SignupOne extends JFrame implements ActionListener{

long random;

JTextField nameTextField, fnameTextField, emailTextField, addressTextField, cityTextField,


stateTextField, pinTextField;

JButton next;

JRadioButton male, female, other, married, unmarried;

JDateChooser dateChooser;

SignupOne(){

setLayout(null);

Random ran=new Random();

random=Math.abs((ran.nextLong() % 9000L) + 1000L);

JLabel formno =new JLabel("APPLICATION FORM NO. " + random);

formno.setFont(new Font("Railway", Font.BOLD, 30));

formno.setBounds(200, 20, 600, 40);

add(formno);

JLabel personalDetails =new JLabel("Page 1: Personal Details");

personalDetails.setFont(new Font("Railway", Font.BOLD, 22));


personalDetails.setBounds(290, 80, 400, 30);

add(personalDetails);

JLabel name =new JLabel("Name: ");

name.setFont(new Font("Railway", Font.BOLD, 20));

name.setBounds(100, 140, 100, 30);

add(name);

nameTextField=new JTextField();

nameTextField.setFont(new Font("Railway", Font.BOLD, 14));

nameTextField.setBounds(300, 140, 400, 30);

add(nameTextField);

JLabel fname =new JLabel("Father's Name: ");

fname.setFont(new Font("Railway", Font.BOLD, 20));

fname.setBounds(100, 190, 200, 30);

add(fname);

fnameTextField=new JTextField();

fnameTextField.setFont(new Font("Railway", Font.BOLD, 14));

fnameTextField.setBounds(300, 190, 400, 30);

add(fnameTextField);

JLabel dob =new JLabel("Date of Birth: ");

dob.setFont(new Font("Railway", Font.BOLD, 20));

dob.setBounds(100, 240, 200, 30);

add(dob);

dateChooser =new JDateChooser();

dateChooser.setBounds(300, 240, 400,30);

dateChooser.setForeground(new Color(105,105,105));
add(dateChooser);

JLabel gender =new JLabel("Gender: ");

gender.setFont(new Font("Railway", Font.BOLD, 20));

gender.setBounds(100, 290, 200, 30);

add(gender);

male =new JRadioButton("Male");

male.setBounds(300, 290, 60, 30);

male.setBackground(Color.WHITE);

add(male);

female =new JRadioButton("Female");

female.setBounds(450, 290, 60, 30);

female.setBackground(Color.WHITE);

add(female);

ButtonGroup genderGroup=new ButtonGroup();

genderGroup.add(male);

genderGroup.add(female);

JLabel email =new JLabel("Email Address: ");

email.setFont(new Font("Railway", Font.BOLD, 20));

email.setBounds(100, 340, 200, 30);

add(email);

emailTextField=new JTextField();

emailTextField.setFont(new Font("Railway", Font.BOLD, 14));

emailTextField.setBounds(300, 340, 400, 30);

add(emailTextField);

JLabel marital =new JLabel("Marital Status: ");


marital.setFont(new Font("Railway", Font.BOLD, 20));

marital.setBounds(100, 390, 200, 30);

add(marital);

married =new JRadioButton("Married");

married.setBounds(300, 390, 100, 30);

married.setBackground(Color.WHITE);

add(married);

unmarried =new JRadioButton("Unmarried");

unmarried.setBounds(450, 390, 100, 30);

unmarried.setBackground(Color.WHITE);

add(unmarried);

other =new JRadioButton("Other");

other.setBounds(630, 390, 100, 30);

other.setBackground(Color.WHITE);

add(other);

ButtonGroup maritalGroup=new ButtonGroup();

maritalGroup.add(married);

maritalGroup.add(unmarried);

maritalGroup.add(other);

JLabel address =new JLabel("Address: ");

address.setFont(new Font("Railway", Font.BOLD, 20));

address.setBounds(100, 440, 200, 30);

add(address);

addressTextField=new JTextField();

addressTextField.setFont(new Font("Railway", Font.BOLD, 14));

addressTextField.setBounds(300, 440, 400, 30);

add(addressTextField);
JLabel city =new JLabel("City: ");

city.setFont(new Font("Railway", Font.BOLD, 20));

city.setBounds(100, 490, 200, 30);

add(city);

cityTextField=new JTextField();

cityTextField.setFont(new Font("Railway", Font.BOLD, 14));

cityTextField.setBounds(300, 490, 400, 30);

add(cityTextField);

JLabel state =new JLabel("State: ");

state.setFont(new Font("Railway", Font.BOLD, 20));

state.setBounds(100, 540, 200, 30);

add(state);

stateTextField=new JTextField();

stateTextField.setFont(new Font("Railway", Font.BOLD, 14));

stateTextField.setBounds(300, 540, 400, 30);

add(stateTextField);

JLabel pincode =new JLabel("Pincode: ");

pincode.setFont(new Font("Railway", Font.BOLD, 20));

pincode.setBounds(100, 590, 200, 30);

add(pincode);

pinTextField=new JTextField();

pinTextField.setFont(new Font("Railway", Font.BOLD, 14));

pinTextField.setBounds(300, 590, 400, 30);

add(pinTextField);

next =new JButton("Next");


next.setBackground(Color.DARK_GRAY);

next.setForeground(Color.WHITE);

next.setFont(new Font("Railway", Font.BOLD, 14));

next.setBounds(620, 660, 80, 30);

next.addActionListener(this);

add(next);

getContentPane().setBackground(Color.WHITE);

setSize(850, 800);

setLocation(350, 10);

setVisible(true);

public void actionPerformed(ActionEvent ae){

String formno =""+random;

String name = nameTextField.getText();

String fname = fnameTextField.getText();

String dob = ((JTextField) dateChooser.getDateEditor().getUiComponent()).getText();

String gender =null;

if(male.isSelected()){

gender="Male";

}else if(female.isSelected()){

gender="Female";

String email = emailTextField.getText();

String marital = null;

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();

String pin = pinTextField.getText();

try{

if(name.equals("")){

JOptionPane.showMessageDialog(null, "Name is Required");

}else{

Conn c=new Conn();

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);

public static void main(String[] args) {

new SignupOne();

SignupThree.java

package atm_interface;

import java.awt.*;
import java.awt.event.*;

import java.util.*;

import javax.swing.*;

public class SignupThree extends JFrame implements ActionListener{

JRadioButton r1,r2,r3,r4;

JCheckBox c1,c2,c3,c4,c5,c6,c7;

JButton submit, cancel;

String formno;

SignupThree(String formno){

this.formno=formno;

setLayout(null);

JLabel l1 = new JLabel("Page 3: Account Details");

l1.setFont(new Font("Railway",Font.BOLD, 27));

l1.setBounds(280, 40, 400, 40);

add(l1);

JLabel type = new JLabel("Account Type");

type.setFont(new Font("Railway",Font.BOLD, 22));

type.setBounds(100, 140, 200, 30);

add(type);

r1 =new JRadioButton("Saving Account");

r1.setFont(new Font("Railway",Font.BOLD,16));

r1.setBackground(Color.WHITE);

r1.setBounds(100, 180, 150, 20);

add(r1);

r2 =new JRadioButton("Fixed Deposit Account");

r2.setFont(new Font("Railway",Font.BOLD,16));
r2.setBackground(Color.WHITE);

r2.setBounds(350, 180, 250, 20);

add(r2);

r3 =new JRadioButton("Current Account");

r3.setFont(new Font("Railway",Font.BOLD,16));

r3.setBackground(Color.WHITE);

r3.setBounds(100, 220, 150, 20);

add(r3);

r4 =new JRadioButton("Recuring Deposit Account");

r4.setFont(new Font("Railway",Font.BOLD,16));

r4.setBackground(Color.WHITE);

r4.setBounds(350, 220, 250, 20);

add(r4);

ButtonGroup groupaccount= new ButtonGroup();

groupaccount.add(r1);

groupaccount.add(r2);

groupaccount.add(r3);

groupaccount.add(r4);

JLabel card = new JLabel("Card Number");

card.setFont(new Font("Railway",Font.BOLD, 22));

card.setBounds(100, 300, 200, 30);

add(card);

JLabel number = new JLabel("XXXX-XXXX-XXXX-4185");

number.setFont(new Font("Railway",Font.BOLD, 22));

number.setBounds(330, 300, 300, 30);

add(number);
JLabel carddetails = new JLabel("Your 16 Digit Card Number");

carddetails.setFont(new Font("Railway",Font.BOLD, 12));

carddetails.setBounds(100, 330, 300, 20);

add(carddetails);

JLabel pin = new JLabel("PIN");

pin.setFont(new Font("Railway",Font.BOLD, 22));

pin.setBounds(100, 370, 200, 30);

add(pin);

JLabel pnumber = new JLabel("XXXX");

pnumber.setFont(new Font("Railway",Font.BOLD, 22));

pnumber.setBounds(330, 370, 300, 30);

add(pnumber);

JLabel pindetails = new JLabel("Your 4 Digit Password");

pindetails.setFont(new Font("Railway",Font.BOLD, 12));

pindetails.setBounds(100, 400, 300, 20);

add(pindetails);

JLabel services = new JLabel("Services Required:");

services.setFont(new Font("Railway",Font.BOLD, 22));

services.setBounds(100, 450, 210, 30);

add(services);

c1 =new JCheckBox("ATM CARD");

c1.setBackground(Color.WHITE);

c1.setFont(new Font("Railway", Font.BOLD, 16));

c1.setBounds(100,500,200,30);
add(c1);

c2 =new JCheckBox("Internet Banking");

c2.setBackground(Color.WHITE);

c2.setFont(new Font("Railway", Font.BOLD, 16));

c2.setBounds(350,500,200,30);

add(c2);

c3 =new JCheckBox("Email & SMS Alerts");

c3.setBackground(Color.WHITE);

c3.setFont(new Font("Railway", Font.BOLD, 16));

c3.setBounds(100,550,200,30);

add(c3);

c4 =new JCheckBox("Cheque Book");

c4.setBackground(Color.WHITE);

c4.setFont(new Font("Railway", Font.BOLD, 16));

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.setFont(new Font("Railway", Font.BOLD, 12));

c5.setBounds(100,600,450,30);

add(c5);

submit =new JButton("Submit");

submit.setBackground(Color.DARK_GRAY);

submit.setForeground(Color.WHITE);

submit.setFont(new Font("Railway", Font.BOLD, 14));

submit.setBounds(100, 720, 100, 30);


submit.addActionListener(this);

add(submit);

cancel =new JButton("Cancel");

cancel.setBackground(Color.DARK_GRAY);

cancel.setForeground(Color.WHITE);

cancel.setFont(new Font("Railway", Font.BOLD, 14));

cancel.setBounds(450, 720, 100, 30);

cancel.addActionListener(this);

add(cancel);

getContentPane().setBackground(Color.WHITE);

setSize(850,820);

setLocation(350, 0);

setVisible(true);

public void actionPerformed(ActionEvent ae){

if(ae.getSource()==submit){

String accountType=null;

if(r1.isSelected()){

accountType="Saving Account";

}else if(r2.isSelected()){

accountType="Fixed Deposit Account";

}else if(r3.isSelected()){

accountType="Current Account";

}else if(r4.isSelected()){

accountType="Reccuring Deposit Account";

Random random= new Random();

String cardnumber = "" + Math.abs((random.nextLong() % 90000000)+ 5040936000000000L);


String pinnumber = "" + Math.abs((random.nextLong() % 9000L)+ 1000L);

String facility ="";

if(c1.isSelected()){

facility=facility+" ATM Card";

}else if(c2.isSelected()){

facility=facility+" Internet Banking";

}else if(c3.isSelected()){

facility=facility+" EMAIL & SMS Alerts";

}else if(c4.isSelected()){

facility=facility+" Cheque Books";

try{

if(accountType.equals("")){

JOptionPane.showMessageDialog(null, "Account Type is Required");

}else{

Conn conn=new Conn();

String query1= "insert into signupthree values('"+formno+"', '"+accountType+"',


'"+cardnumber+"', '"+pinnumber+"', '"+facility+"')";

String query2= "insert into login values('"+formno+"', '"+cardnumber+"',


'"+pinnumber+"')";

conn.s.executeUpdate(query1);

conn.s.executeUpdate(query2);

JOptionPane.showMessageDialog(null, "Card Number "+ cardnumber + "\n pin: "+


pinnumber);

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);

public static void main(String[] args) {

new SignupThree("");

SignupTwo.java

package atm_interface;

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

public class SignupTwo extends JFrame implements ActionListener{

JTextField pan,aadhar;

JButton next;

JRadioButton syes,sno,eyes,eno;

JComboBox religion ,category, occupation, education, income;

String formno;

SignupTwo(String formno){

this.formno=formno;

setLayout(null);

setTitle("NEW ACCOUNT APPLICATION FORM - PAGE 2");

JLabel additionalDetails =new JLabel("Page 2: Additional Details");

additionalDetails.setFont(new Font("Railway", Font.BOLD, 22));

additionalDetails.setBounds(290, 80, 400, 30);

add(additionalDetails);
JLabel religionLabel =new JLabel("Religion: ");

religionLabel.setFont(new Font("Railway", Font.BOLD, 20));

religionLabel.setBounds(100, 140, 100, 30);

add(religionLabel);

String valReligion[]={"Hindu","Muslim","Sikh","Christian","Other"};

religion =new JComboBox(valReligion);

religion.setBounds(300, 140, 400, 30);

religion.setBackground(Color.WHITE);

add(religion);

JLabel incomeLabel =new JLabel("Income: ");

incomeLabel.setFont(new Font("Railway", Font.BOLD, 20));

incomeLabel.setBounds(100, 190, 200, 30);

add(incomeLabel);

String incomecategory[]={"Null","< 1,50,000","< 2,50,0000","< 5,00,000","Upto 10,00,000"};

income =new JComboBox(incomecategory);

income.setBounds(300, 190, 400, 30);

income.setBackground(Color.WHITE);

add(income);

JLabel educationLabel =new JLabel("Educational");

educationLabel.setFont(new Font("Railway", Font.BOLD, 20));

educationLabel.setBounds(100, 240, 200, 30);

add(educationLabel);

JLabel qualificationLabel =new JLabel("Qualification: ");

qualificationLabel.setFont(new Font("Railway", Font.BOLD, 20));

qualificationLabel.setBounds(100, 265, 200, 30);

add(qualificationLabel);
String educationValues[]={"Non Graduation","Graduate","Post
Graduation","Doctrate","Others"};

education =new JComboBox(educationValues);

education.setBounds(300, 260, 400, 30);

education.setBackground(Color.WHITE);

add(education);

JLabel occupationLabel =new JLabel("Occupation: ");

occupationLabel.setFont(new Font("Railway", Font.BOLD, 20));

occupationLabel.setBounds(100, 340, 200, 30);

add(occupationLabel);

String occupationValues[]={"Salaried","Self
Employed","Bussiness","Student","Retired","Others"};

occupation =new JComboBox(occupationValues);

occupation.setBounds(300, 340, 400, 30);

occupation.setBackground(Color.WHITE);

add(occupation);

JLabel panLabel =new JLabel("PAN Number: ");

panLabel.setFont(new Font("Railway", Font.BOLD, 20));

panLabel.setBounds(100, 390, 200, 30);

add(panLabel);

pan=new JTextField();

pan.setFont(new Font("Railway", Font.BOLD, 14));

pan.setBounds(300, 390, 400, 30);

add(pan);

JLabel aadharLabel =new JLabel("Aadhar Number: ");


aadharLabel.setFont(new Font("Railway", Font.BOLD, 20));

aadharLabel.setBounds(100, 440, 200, 30);

add(aadharLabel);

aadhar=new JTextField();

aadhar.setFont(new Font("Railway", Font.BOLD, 14));

aadhar.setBounds(300, 440, 400, 30);

add(aadhar);

JLabel citizenLabel =new JLabel("Senior Citizen: ");

citizenLabel.setFont(new Font("Railway", Font.BOLD, 20));

citizenLabel.setBounds(100, 490, 200, 30);

add(citizenLabel);

syes =new JRadioButton("Yes");

syes.setBounds(300, 490, 100, 30);

syes.setBackground(Color.WHITE);

add(syes);

sno =new JRadioButton("No");

sno.setBounds(450, 490, 100, 30);

sno.setBackground(Color.WHITE);

add(sno);

ButtonGroup maritalGroup=new ButtonGroup();

maritalGroup.add(syes);

maritalGroup.add(sno);

JLabel accountLabel =new JLabel("Existing Account: ");

accountLabel.setFont(new Font("Railway", Font.BOLD, 20));

accountLabel.setBounds(100, 540, 200, 30);


add(accountLabel);

eyes =new JRadioButton("Yes");

eyes.setBounds(300, 540, 100, 30);

eyes.setBackground(Color.WHITE);

add(eyes);

eno =new JRadioButton("No");

eno.setBounds(450, 540, 100, 30);

eno.setBackground(Color.WHITE);

add(eno);

ButtonGroup accountGroup=new ButtonGroup();

accountGroup.add(eyes);

accountGroup.add(eno);

next =new JButton("Next");

next.setBackground(Color.DARK_GRAY);

next.setForeground(Color.WHITE);

next.setFont(new Font("Railway", Font.BOLD, 14));

next.setBounds(620, 660, 80, 30);

next.addActionListener(this);

add(next);

getContentPane().setBackground(Color.WHITE);

setSize(850, 800);

setLocation(350, 10);

setVisible(true);

public void actionPerformed(ActionEvent ae){

String sreligion = (String)religion.getSelectedItem();


String sincome = (String) income.getSelectedItem();

String seducation =(String) education.getSelectedItem();

String soccupation =(String) occupation.getSelectedItem();

String seniorcitizen =null;

if(syes.isSelected()){

seniorcitizen="Yes";

}else if(sno.isSelected()){

seniorcitizen="No";

String existingaccount = null;

if(eyes.isSelected()){

existingaccount="Yes";

}else if(eno.isSelected()){

existingaccount="No";

String span=pan.getText();

String saadhar=aadhar.getText();

try{

Conn c=new Conn();

String query ="insert into signuptwo values ('"+formno+"', '"+sreligion+"', '"+sincome+"',


'"+seducation+"', '"+soccupation+"', '"+span+"', '"+saadhar+"', '"+seniorcitizen+"',
'"+existingaccount+"')";

c.s.executeUpdate(query);

//create SignUp3 object

setVisible(false);

new SignupThree(formno).setVisible(true);;

}catch(Exception e){

System.out.println(e);
}

public static void main(String[] args) {

new SignupTwo("");

Transactions.java

package atm_interface;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class Transactions extends JFrame implements ActionListener {

JButton deposit, withdrawl,fastcash, ministatement,pinchange, balanceenquiry,exit;

String pinnumber;

Transactions(String pinnumber){

this.pinnumber=pinnumber;

setLayout(null);

ImageIcon i1=new ImageIcon(ClassLoader.getSystemResource("icons/atmlogo.jpg"));

Image i2=i1.getImage().getScaledInstance(900, 900, Image.SCALE_DEFAULT);

ImageIcon i3=new ImageIcon(i2);

JLabel image=new JLabel(i3);

image.setBounds(0, 0, 900, 900);

add(image);

JLabel text =new JLabel("Please select your Transaction");

text.setBounds(225, 300, 760, 35);

text.setForeground(Color.WHITE);

text.setFont(new Font("System", Font.BOLD, 16));

image.add(text);//add text on image


deposit=new JButton("Deposit");

deposit.setBounds(170, 415, 150, 30);

deposit.addActionListener(this);

image.add(deposit);

withdrawl=new JButton("Cash Withdrawl");

withdrawl.setBounds(355, 415, 150, 30);

withdrawl.addActionListener(this);

image.add(withdrawl);

fastcash=new JButton("Fast Cash");

fastcash.setBounds(170, 450, 150, 30);

fastcash.addActionListener(this);

image.add(fastcash);

ministatement=new JButton("Mini Statement");

ministatement.setBounds(355, 450, 150, 30);

ministatement.addActionListener(this);

image.add(ministatement);

pinchange=new JButton("Pin Change");

pinchange.setBounds(170, 485, 150, 30);

pinchange.addActionListener(this);

image.add(pinchange);

balanceenquiry=new JButton("Balance Enquiry");

balanceenquiry.setBounds(355, 485, 150, 30);

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);

public void actionPerformed(ActionEvent ae){

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);

}
}

public static void main(String[] args) {

new Transactions("");

Withdrawl.java

package atm_interface;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.util.*;

public class Withdrawl extends JFrame implements ActionListener{

JTextField amount;

JButton withdraw, back;

String pinnumber;

Withdrawl(String pinnumber){

this.pinnumber=pinnumber;

ImageIcon i1=new ImageIcon(ClassLoader.getSystemResource("icons/atmlogo.jpg"));

Image i2=i1.getImage().getScaledInstance(900, 900, Image.SCALE_DEFAULT);

ImageIcon i3=new ImageIcon(i2);

JLabel image=new JLabel(i3);

image.setBounds(0, 0, 900, 900);

add(image);

JLabel text =new JLabel("Enter the amount you want to Withdraw");

text.setBounds(170, 300, 400, 20);

text.setForeground(Color.WHITE);

text.setFont(new Font("System", Font.BOLD, 16));

image.add(text);

amount=new JTextField();
amount.setFont(new Font("Railway", Font.BOLD, 22));

amount.setBounds(170, 350, 320, 25);

image.add(amount);

withdraw=new JButton("withdraw");

withdraw.setBounds(355, 485, 150, 30);

withdraw.addActionListener(this);

image.add(withdraw);

back=new JButton("Back");

back.setBounds(355, 520, 150, 30);

back.addActionListener(this);

image.add(back);

setSize(900, 900);

setLocation(300,0);

setVisible(true);

public void actionPerformed(ActionEvent ae){

if(ae.getSource()==withdraw){

String number=amount.getText();

Date date=new Date();

if (number.equals("")){

JOptionPane.showMessageDialog(null, "Please enter the amount you want to withdraw");

}else{

try{

Conn conn=new Conn();

String query="insert into bank values ('"+pinnumber+"', '"+date+"', 'Withdrawl',


'"+number+"')";

conn.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Rs "+number+" Withdraw Successfully");


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);

public static void main(String[] args) {

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

You might also like