ATM Project In Java With Source Code
The ATM Project In Java is developed using Java Programming Language and MySQL Database as storage of data.
This ATM Program In Java With Database was designed in a Graphical User Interface(GUI), and This Code For ATM In Java is good for students or beginners who want to learn Java Programming.
An ATM Machine Java Program is used for an electronic banking outlet that allows customers to complete basic transactions without the aid of a branch representative or teller.
In this ATM Program In Java Netbeans are allowing consumers to perform quick self-service transactions such as deposits, cash withdrawals, and checking balances.
This ATM Project In Java Using Netbeans also includes a downloadable ATM Project In Java With Source Code for free, just find the downloadable source code below and click to start downloading.
To start creating an ATM Project In Java, make sure that you have NetBeans IDE or any platform of Java installed on your computer.
About The ATM Project In Java
Project Name: | ATM Project |
Language/s Used: | JAVA |
Database: | None |
Type: | Desktop Application |
Developer: | IT SOURCECODE |
Updates: | 0 |
How to Create an ATM System Project in Java? A Step-by-step Guide with source code
Time needed: 5 minutes
These are the steps on how to create an ATM Project In Java With Source Code
- Step 1: Create project.
First, open the file and then click “project” to create.
- Step 2: Create project name.
Second, name your project.
- Step 3: Create JFrame.
Third, create a “JFrame” form.
- Step 4: Create a JFrame name.
Fourth, name your JFrame form.
- Step 5: Project Design.
Fifth, The actual design of the project.
The Code Given Below Is For Deposit Module
package atm_system;
import java.awt.Toolkit;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Boniface Kipruto
*/
public class deposit extends javax.swing.JFrame {
/**
* Creates new form splash
*/
public deposit() {
initComponents();
seticon();
}
private void seticon() {
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("ATM.png")));
}
int balancz;
int operation;
Connection con;
ResultSet rs;
Statement st;
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
cancel = new javax.swing.JButton();
enter = new javax.swing.JButton();
clear = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
back = new javax.swing.JButton();
deposit = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
note = new javax.swing.JLabel();
notes1 = new javax.swing.JLabel();
note3 = new javax.swing.JLabel();
collect = new javax.swing.JTextField();
jButton11 = new javax.swing.JButton();
balance = new javax.swing.JButton();
favourite = new javax.swing.JButton();
jPanel9 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(204, 204, 255));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
});
jPanel1.setBackground(new java.awt.Color(255, 204, 204));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBackground(new java.awt.Color(51, 51, 51));
jPanel2.setBorder(javax.swing.BorderFactory.createMatteBorder(21, 8, -10, 8, new java.awt.Color(204, 204, 255)));
jButton1.setText("1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("7");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("4");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("8");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setText("5");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setText("2");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton7.setText("0");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setText("9");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jButton9.setText("6");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jButton10.setText("3");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(48, 48, 48)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 186, -1, 278));
jPanel3.setBackground(new java.awt.Color(51, 51, 51));
jPanel3.setBorder(javax.swing.BorderFactory.createMatteBorder(21, 8, -10, 8, new java.awt.Color(204, 204, 204)));
cancel.setBackground(new java.awt.Color(255, 0, 0));
cancel.setText("CANCEL");
cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelActionPerformed(evt);
}
});
enter.setBackground(new java.awt.Color(0, 153, 153));
enter.setForeground(new java.awt.Color(255, 255, 255));
enter.setText("ENTER");
enter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
enterActionPerformed(evt);
}
});
clear.setBackground(new java.awt.Color(204, 204, 0));
clear.setText("CLEAR");
clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearActionPerformed(evt);
}
});
jButton14.setBackground(new java.awt.Color(102, 255, 255));
jButton14.setFont(new java.awt.Font("sansserif", 1, 14)); // NOI18N
jButton14.setForeground(new java.awt.Color(0, 0, 204));
jButton14.setText("!");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(enter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(16, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(cancel, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(enter, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(21, Short.MAX_VALUE))
);
jPanel1.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(469, 186, -1, -1));
back.setText(">>>>");
back.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backActionPerformed(evt);
}
});
jPanel1.add(back, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 19, -1, -1));
deposit.setText(">>>>");
deposit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
depositActionPerformed(evt);
}
});
jPanel1.add(deposit, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 100, -1, -1));
jPanel4.setBackground(new java.awt.Color(0, 0, 153));
jPanel4.setBorder(javax.swing.BorderFactory.createMatteBorder(18, 6, -12, 6, new java.awt.Color(0, 0, 0)));
jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
note.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
note.setText("Enter amount to deposit:");
jPanel4.add(note, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 54, 221, 29));
notes1.setFont(new java.awt.Font("sansserif", 1, 14)); // NOI18N
notes1.setForeground(new java.awt.Color(0, 0, 51));
notes1.setText("Hello");
jPanel4.add(notes1, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 29, 194, -1));
note3.setFont(new java.awt.Font("sansserif", 1, 12)); // NOI18N
note3.setForeground(new java.awt.Color(255, 0, 0));
jPanel4.add(note3, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 115, 143, 15));
collect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
collectActionPerformed(evt);
}
});
jPanel4.add(collect, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 89, 131, -1));
jPanel1.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 19, -1, -1));
jButton11.setForeground(new java.awt.Color(255, 0, 102));
jButton11.setText("X");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});
jPanel1.add(jButton11, new org.netbeans.lib.awtextra.AbsoluteConstraints(588, 0, -1, -1));
balance.setText("<<<<");
balance.setBorder(javax.swing.BorderFactory.createEtchedBorder());
balance.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
balanceActionPerformed(evt);
}
});
jPanel1.add(balance, new org.netbeans.lib.awtextra.AbsoluteConstraints(469, 19, 67, 26));
favourite.setText("<<<<");
favourite.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
favouriteActionPerformed(evt);
}
});
jPanel1.add(favourite, new org.netbeans.lib.awtextra.AbsoluteConstraints(469, 113, -1, -1));
jPanel9.setBackground(new java.awt.Color(153, 153, 255));
jLabel10.setFont(new java.awt.Font("Impact", 1, 24)); // NOI18N
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("Bangko Iniduro");
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel5.setText("BANK");
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(32, Short.MAX_VALUE))
);
jPanel9Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel10, jLabel5});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void favouriteActionPerformed(java.awt.event.ActionEvent evt) {
notes1.setText("This feature is");
note.setText("NOT availlable!!!");
}
private void cancelActionPerformed(java.awt.event.ActionEvent evt) {
note.setText("SEE YOU BACK AGAIN");
note3.setText("***ATM MACHINE***");
notes1.setText("****ATM MACHINE***");
//pin.setVisible(false);
clear.setEnabled(false);
enter.setEnabled(false);
//System.exit(0);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"1";
// pin.setText(num);
collect.setText(num);
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"2";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"3";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"4";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"5";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"6";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"7";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"8";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"9";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"0";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void clearActionPerformed(java.awt.event.ActionEvent evt) {
//pin.setText("");
collect.setText("");// TODO add your handling code here:
}
private void enterActionPerformed(java.awt.event.ActionEvent evt) {
int amount=Integer.parseInt(collect.getText());
//int temp=balancz+amount;
if(amount>=50000){
note.setText("amount is greater than 50000");
notes1.setText("logout to try again!!");
collect.setVisible(false);
}
else if(amount<=50){
note.setText("Amount too low to deposit");
notes1.setText("logout to try again!!");
collect.setVisible(false);
}
else{
try{
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/atm", "root", "");
st = con.createStatement();
String name=notes1.getText();
String query = "SELECT * FROM customer WHERE fname = '"+notes1.getText()+"'";
rs = st.executeQuery(query);
if(rs.next()){
int balan=rs.getInt("balance");
int id=rs.getInt("ID");
int temp=balan+amount;
String strSQL = "Update customer set balance = "+(temp)+" where ID = " +(id);
int rowsEffected = st.executeUpdate(strSQL);
if (rowsEffected == 0){
note.setText("Amount Is Not Deposited ");
collect.setVisible(false);
}
else{
note.setText("Amount Is Deposited success ");
collect.setVisible(false);
}
}
con.close();
st.close();
rs.close();
}
catch(Exception e){
System.out.println("That wasnt suppose to happen"+e);
//note.setVisible(false);
}
}
}
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void formWindowActivated(java.awt.event.WindowEvent evt) {
back.setText("Back");
cancel.setEnabled(false);
}
private void balanceActionPerformed(java.awt.event.ActionEvent evt) {
notes1.setText("Current available");
note.setText("balance: ksh "+balancz);
}
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {
notes1.setText("ATM: qweeekmode");
note.setText("VERSION: 9.1.1.1");
}
private void depositActionPerformed(java.awt.event.ActionEvent evt) {
notes1.setText("------------------");
note.setText("Enter amount");
note3.setText("___________________");
collect.setEnabled(true);
collect.setVisible(true);
int depo=Integer.parseInt(collect.getText());
balancz=balancz+depo;
String update="UPDATE customer set balance= +"+(balancz);
try {
st= con.createStatement();
rs = st.executeQuery(update);
} catch (SQLException ex) {
Logger.getLogger(deposit.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void backActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
verify ver=new verify();
ver.setVisible(true);
ver.setLocationRelativeTo(null);
this.dispose();
}
private void collectActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
This module is the module for deposit into the ATM machine system.
The Code Given Below Is For Verify Module
package atm_system;
import java.awt.Toolkit;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Boniface Kipruto
*/
public class verify extends javax.swing.JFrame {
/**
* Creates new form splash
*/
public verify() {
initComponents();
seticon();
}
private void seticon() {
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("ATM.png")));
}
String fnamez;
int balancz;
int operation;
Connection con;
ResultSet rs;
Statement st;
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
cancel = new javax.swing.JButton();
enter = new javax.swing.JButton();
clear = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
widthraw = new javax.swing.JButton();
deposit = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
note = new javax.swing.JLabel();
note1 = new javax.swing.JLabel();
note3 = new javax.swing.JLabel();
pin = new javax.swing.JPasswordField();
jButton11 = new javax.swing.JButton();
balance = new javax.swing.JButton();
favourite = new javax.swing.JButton();
jPanel9 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(204, 204, 255));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
});
jPanel1.setBackground(new java.awt.Color(255, 204, 204));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBackground(new java.awt.Color(51, 51, 51));
jPanel2.setBorder(javax.swing.BorderFactory.createMatteBorder(21, 8, -10, 8, new java.awt.Color(204, 204, 255)));
jButton1.setText("1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("7");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("4");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("8");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setText("5");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setText("2");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton7.setText("0");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setText("9");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jButton9.setText("6");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jButton10.setText("3");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(48, 48, 48)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(134, 215, -1, 278));
jPanel3.setBackground(new java.awt.Color(51, 51, 51));
jPanel3.setBorder(javax.swing.BorderFactory.createMatteBorder(21, 8, -10, 8, new java.awt.Color(204, 204, 204)));
cancel.setBackground(new java.awt.Color(255, 0, 0));
cancel.setText("CANCEL");
cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelActionPerformed(evt);
}
});
enter.setBackground(new java.awt.Color(0, 153, 153));
enter.setForeground(new java.awt.Color(255, 255, 255));
enter.setText("ENTER");
enter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
enterActionPerformed(evt);
}
});
clear.setBackground(new java.awt.Color(204, 204, 0));
clear.setText("CLEAR");
clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearActionPerformed(evt);
}
});
jButton14.setBackground(new java.awt.Color(102, 255, 255));
jButton14.setFont(new java.awt.Font("sansserif", 1, 14)); // NOI18N
jButton14.setForeground(new java.awt.Color(0, 0, 204));
jButton14.setText("!");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(enter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(16, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(cancel, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(enter, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(21, Short.MAX_VALUE))
);
jPanel1.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(473, 215, -1, -1));
widthraw.setText(">>>>");
widthraw.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
widthrawActionPerformed(evt);
}
});
jPanel1.add(widthraw, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 48, -1, -1));
deposit.setText(">>>>");
deposit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
depositActionPerformed(evt);
}
});
jPanel1.add(deposit, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 129, -1, -1));
jPanel4.setBackground(new java.awt.Color(0, 51, 153));
jPanel4.setBorder(javax.swing.BorderFactory.createMatteBorder(18, 6, -12, 6, new java.awt.Color(0, 0, 0)));
jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
note.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
note.setText("PLEASE ENTER YOUR PIN");
jPanel4.add(note, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 54, 221, 29));
note1.setFont(new java.awt.Font("sansserif", 1, 14)); // NOI18N
note1.setForeground(new java.awt.Color(0, 0, 51));
note1.setText("welcome");
jPanel4.add(note1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 29, 190, -1));
note3.setFont(new java.awt.Font("sansserif", 1, 12)); // NOI18N
note3.setForeground(new java.awt.Color(255, 0, 0));
jPanel4.add(note3, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 115, 143, 15));
pin.setBackground(new java.awt.Color(0, 102, 102));
jPanel4.add(pin, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 89, 108, -1));
jPanel1.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 40, -1, -1));
jButton11.setForeground(new java.awt.Color(255, 0, 102));
jButton11.setText("X");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});
jPanel1.add(jButton11, new org.netbeans.lib.awtextra.AbsoluteConstraints(592, 0, -1, -1));
balance.setText("<<<<");
balance.setBorder(javax.swing.BorderFactory.createEtchedBorder());
balance.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
balanceActionPerformed(evt);
}
});
jPanel1.add(balance, new org.netbeans.lib.awtextra.AbsoluteConstraints(473, 48, 67, 26));
favourite.setText("<<<<");
favourite.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
favouriteActionPerformed(evt);
}
});
jPanel1.add(favourite, new org.netbeans.lib.awtextra.AbsoluteConstraints(473, 142, -1, -1));
jPanel9.setBackground(new java.awt.Color(153, 153, 255));
jLabel10.setFont(new java.awt.Font("Impact", 1, 24)); // NOI18N
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("Bangko Iniduro");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel2.setText("BANK");
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(346, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(32, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 1, Short.MAX_VALUE))
.addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void favouriteActionPerformed(java.awt.event.ActionEvent evt) {
note1.setText("This feature is");
note.setText("NOT availlable!!!");
}
private void cancelActionPerformed(java.awt.event.ActionEvent evt) {
note.setText("SEE YOU BACK AGAIN");
note3.setText("***ATM MACHINE***");
note1.setText("****ATM MACHINE***");
pin.setVisible(false);
clear.setEnabled(false);
enter.setEnabled(false);
//System.exit(0);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"1";
pin.setText(num);
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"2";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"3";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"4";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"5";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"6";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"7";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"8";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"9";
pin.setText(num);
// TODO add your handling code here:
}
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
String num=pin.getText()+"0";
pin.setText(num); // TODO add your handling code here:
}
private void clearActionPerformed(java.awt.event.ActionEvent evt) {
pin.setText("");// TODO add your handling code here:
}
private void enterActionPerformed(java.awt.event.ActionEvent evt) {
try{
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/atm", "root", "");
st = con.createStatement();
String query = "SELECT * FROM customer WHERE pin = '"+pin.getText()+"'";
rs = st.executeQuery(query);
if(rs.next()){
balancz =rs.getInt("balance");
//loan.setText("LOAN");
widthraw.setText("Widthraw");
deposit.setText("Deposit");
fnamez=rs.getString("fname");
note.setText("Welcome " + rs.getString("fname") +" "+ rs.getString("lname") +"" );
favourite.setText("*****");
balance.setText("Balance");
// transaction.setText("Transaction");
note3.setText("*************************");
note1.setText("_________________________");
pin.setVisible(false);
//loan.setEnabled(true);
widthraw.setEnabled(true);
//transaction.setEnabled(true);
deposit.setEnabled(true);
favourite.setEnabled(true);
balance.setEnabled(true);
operation=0;
}
else{
note3.setVisible(true);
pin.setText("");
note3.setText("no such user!");
operation=1;
}
}catch(Exception e){
pin.setVisible(false);
note.setText("_______________");
note3.setText("***************");
note1.setText("Oooops!!! connection problem");
//note.setVisible(false);
}
if(operation==0){
}
}
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void formWindowActivated(java.awt.event.WindowEvent evt) {
//loan.setEnabled(false);
widthraw.setEnabled(false);
//transaction.setEnabled(false);
deposit.setEnabled(false);
favourite.setEnabled(false);
balance.setEnabled(false);
}
private void balanceActionPerformed(java.awt.event.ActionEvent evt) {
note1.setText("Current available");
note.setText("balance: Php "+balancz);
}
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {
note1.setText("ATM: quickmode");
note.setText("VERSION: 9.1.1.1");
}
private void depositActionPerformed(java.awt.event.ActionEvent evt) {
deposit depositer= new deposit();
depositer.setVisible(true);
depositer.setLocationRelativeTo(null);
depositer.notes1.setText(fnamez);
this.dispose();
}
private void widthrawActionPerformed(java.awt.event.ActionEvent evt) {
widthraw wed=new widthraw();
wed.setVisible(true);
wed.setLocationRelativeTo(null);
wed.note1.setText(fnamez);
this.dispose();
}
This module is the module for verifying the access user to an ATM machine.
The Code Given Below Is For Widthraw Module
package atm_system;
import java.awt.Toolkit;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Boniface Kipruto
*/
public class widthraw extends javax.swing.JFrame {
/**
* Creates new form splash
*/
public widthraw() {
initComponents();
seticon();
}
private void seticon() {
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("ATM.png")));
}
int balancz;
int operation;
Connection con;
ResultSet rs;
Statement st;
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
cancel = new javax.swing.JButton();
enter = new javax.swing.JButton();
clear = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
back = new javax.swing.JButton();
deposit = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
note = new javax.swing.JLabel();
note1 = new javax.swing.JLabel();
note3 = new javax.swing.JLabel();
collect = new javax.swing.JTextField();
exit = new javax.swing.JButton();
balance = new javax.swing.JButton();
favourite = new javax.swing.JButton();
jPanel9 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(204, 204, 255));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
});
jPanel1.setBackground(new java.awt.Color(255, 204, 204));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBackground(new java.awt.Color(51, 51, 51));
jPanel2.setBorder(javax.swing.BorderFactory.createMatteBorder(21, 8, -10, 8, new java.awt.Color(204, 204, 255)));
jButton1.setText("1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("7");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("4");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("8");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setText("5");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setText("2");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton7.setText("0");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setText("9");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jButton9.setText("6");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jButton10.setText("3");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(48, 48, 48)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 215, -1, 278));
jPanel3.setBackground(new java.awt.Color(51, 51, 51));
jPanel3.setBorder(javax.swing.BorderFactory.createMatteBorder(21, 8, -10, 8, new java.awt.Color(204, 204, 204)));
cancel.setBackground(new java.awt.Color(255, 0, 0));
cancel.setText("CANCEL");
cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelActionPerformed(evt);
}
});
enter.setBackground(new java.awt.Color(0, 153, 153));
enter.setForeground(new java.awt.Color(255, 255, 255));
enter.setText("ENTER");
enter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
enterActionPerformed(evt);
}
});
clear.setBackground(new java.awt.Color(204, 204, 0));
clear.setText("CLEAR");
clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearActionPerformed(evt);
}
});
jButton14.setBackground(new java.awt.Color(102, 255, 255));
jButton14.setFont(new java.awt.Font("sansserif", 1, 14)); // NOI18N
jButton14.setForeground(new java.awt.Color(0, 0, 204));
jButton14.setText("!");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(enter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(16, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(cancel, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(enter, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(21, Short.MAX_VALUE))
);
jPanel1.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(469, 215, -1, -1));
back.setText(">>>>");
back.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backActionPerformed(evt);
}
});
jPanel1.add(back, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 48, -1, -1));
deposit.setText(">>>>");
deposit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
depositActionPerformed(evt);
}
});
jPanel1.add(deposit, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 129, -1, -1));
jPanel4.setBackground(new java.awt.Color(0, 0, 153));
jPanel4.setBorder(javax.swing.BorderFactory.createMatteBorder(18, 6, -12, 6, new java.awt.Color(0, 0, 0)));
note.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
note.setText("Enter amount to widthraw:");
note1.setFont(new java.awt.Font("sansserif", 1, 14)); // NOI18N
note1.setForeground(new java.awt.Color(0, 0, 51));
note1.setText("Hello");
note3.setFont(new java.awt.Font("sansserif", 1, 12)); // NOI18N
note3.setForeground(new java.awt.Color(255, 0, 0));
collect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
collectActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(44, 44, 44)
.addComponent(note3, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(54, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(note, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(collect)
.addGap(100, 100, 100))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(note1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(37, 37, 37))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(note1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(note, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(collect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(note3, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(18, Short.MAX_VALUE))
);
jPanel1.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 48, -1, -1));
exit.setForeground(new java.awt.Color(255, 0, 102));
exit.setText("X");
exit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitActionPerformed(evt);
}
});
jPanel1.add(exit, new org.netbeans.lib.awtextra.AbsoluteConstraints(588, 0, -1, -1));
balance.setText("<<<<");
balance.setBorder(javax.swing.BorderFactory.createEtchedBorder());
balance.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
balanceActionPerformed(evt);
}
});
jPanel1.add(balance, new org.netbeans.lib.awtextra.AbsoluteConstraints(469, 48, 67, 26));
favourite.setText("<<<<");
favourite.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
favouriteActionPerformed(evt);
}
});
jPanel1.add(favourite, new org.netbeans.lib.awtextra.AbsoluteConstraints(469, 142, -1, -1));
jPanel9.setBackground(new java.awt.Color(153, 153, 255));
jLabel10.setFont(new java.awt.Font("Impact", 1, 24)); // NOI18N
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("Bangko Iniduro");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel2.setText("BANK");
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addContainerGap(32, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void favouriteActionPerformed(java.awt.event.ActionEvent evt) {
note1.setText("This feature is");
note.setText("NOT availlable!!!");
}
private void cancelActionPerformed(java.awt.event.ActionEvent evt) {
note.setText("SEE YOU BACK AGAIN");
note3.setText("***ATM MACHINE***");
note1.setText("****ATM MACHINE***");
//pin.setVisible(false);
clear.setEnabled(false);
enter.setEnabled(false);
//System.exit(0);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"1";
// pin.setText(num);
collect.setText(num);
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"2";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"3";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"4";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"5";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"6";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"7";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"8";
//pin.setText(num);
collect.setText(num); // TODO add your handling code here:
}
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"9";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
String num=collect.getText()+"0";
//pin.setText(num);
collect.setText(num);// TODO add your handling code here:
}
private void clearActionPerformed(java.awt.event.ActionEvent evt) {
//pin.setText("");
collect.setText("");// TODO add your handling code here:
}
private void enterActionPerformed(java.awt.event.ActionEvent evt) {
int wid=Integer.parseInt(collect.getText()) ;
if(wid>=170000){
note1.setText("Logout to try again");
note.setText("Amount is exceeds normals");
collect.setVisible(false);
}
else if(wid<=99){
note1.setText("Logout to try again");
note.setText("Amounts too low");
collect.setVisible(false);
}else{
try{
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/atm", "root", "");
st = con.createStatement();
String name=note1.getText();
String query = "SELECT * FROM customer WHERE fname = '"+note1.getText()+"'";
rs = st.executeQuery(query);
if(rs.next()){
int balan=rs.getInt("balance");
int id=rs.getInt("ID");
if(balan>=wid){
int temp=balan-wid;
String strSQL = "Update customer set balance = "+(temp)+" where ID = " +(id);
int rowsEffected = st.executeUpdate(strSQL);
if (rowsEffected == 0){
note.setText("No widthrawal occured");
collect.setVisible(false);
}
else{
note.setText("Widthrawal of Ksh"+(wid)+" success");
collect.setVisible(false);
}
}
else{note.setText("Insufficient balance");}
con.close();
st.close();
rs.close();
}
}
catch(Exception e){
System.out.println("That wasnt suppose to happen"+e);
//note.setVisible(false);
}
}
}
private void exitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void formWindowActivated(java.awt.event.WindowEvent evt) {
back.setText("Back");
cancel.setEnabled(false);
}
private void balanceActionPerformed(java.awt.event.ActionEvent evt) {
note1.setText("Current available");
note.setText("balance: ksh "+balancz);
}
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {
note1.setText("ATM: qweeekmode");
note.setText("VERSION: 9.1.1.1");
}
private void depositActionPerformed(java.awt.event.ActionEvent evt) {
note1.setText("------------------");
note.setText("Enter amount");
note3.setText("___________________");
collect.setEnabled(true);
collect.setVisible(true);
int depo=Integer.parseInt(collect.getText());
balancz=balancz+depo;
String update="UPDATE customer set balance= +"+(balancz);
try {
st= con.createStatement();
rs = st.executeQuery(update);
} catch (SQLException ex) {
Logger.getLogger(deposit.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void backActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
verify ver=new verify();
this.dispose();
ver.setVisible(true);
ver.setLocationRelativeTo(null);
}
private void collectActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
In this module, the user can withdraw to the ATM machine.
Downloadable Source Code Below
Anyway, if you want to level up your programming knowledge, especially Java, try this new article I’ve made for you Best Java Projects With Source Code For Beginners Free Download.
Summary
The ATM Project In Java With Source Code is built fully in Java and MySQL Database. It has a full-featured Graphical User Interface (GUI) with all the functionalities.
This Article is a way to enhance and develop our skills and logic ideas which is important in practicing the Java programming language which is the most well-known and most usable programming language in many companies.
Related article below
- Load data from MySQL database to Combo box Using Java
- How to use Scanner in Java Tutorial Using Netbeans IDE
- Update Data using MySQL Database and Java with Netbeans IDE
- Join Two String Value using MySQL CONCAT Function in Java
- How to Load Data from Mysql Database to Table Element Using Java
Inquiries
If you have any questions or suggestions about the ATM Project In Java With Source Code, please feel free to leave a comment below.
when I load your project into NetBeans,there is a problem:
“MySQLDriver” library could be found(in ATM_SYSTEM)
could you help me about this problem?
oh, i replied just now, but I have fixed it right now,so don’t need to reply my comment.
By the way, your ATM project is awesome for a java beginner like me.
thankyou for being interested in our project
how youve fixed it
when I load your project into NetBeans,there is a problem:
“MySQLDriver” library could be found(in ATM_SYSTEM)
could you help me about this problem?
Hello, thanks for the source code. I tried it but when I enter the pin it tells me “oops…..”
Can you help me with this, please? Thank you very much indeed.