mga sir patulong naman po... tapos na po ako sa design ng ATM ko .ang kulang nalang po e yung mga codes po.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import java.awt.font.*;
import javax.swing.plaf.FontUIResource;
public class ATMDesign extends JFrame implements ActionListener {
JFrame ATMframe = new JFrame("ATM Menu");
int PIN = 1234;
int ctr = 0;
int NewPIN;
double money = 0.0;
JLabel lblPIN, lblbg;
JPasswordField pfldPIN;
JButton btnOK, btnClose, btnClear;
public int getPIN(){
return PIN;
}
public void setPIN(int pn)
{
this.PIN = pn;
}
public void changePIN(int iPIN)
{
setPIN(iPIN);
}
public ATMDesign()
{
UIManager UI=new UIManager();
UI.put("OptionPane.background", Color.white);
UI.put("Panel.background", Color.cyan);
UI.put("Button.background", Color.orange);
UI.put("PasswordField.background", new ColorUIResource(255,255,255));
UI.put("OptionPane.buttonFont", new FontUIResource(new Font("ARIAL",Font.PLAIN,80)));
UI.put("OptionPane.minimumSize",new Dimension(1017,570));
setFont(new Font("Dialog", Font.PLAIN, 70));
setForeground(new Color(0, 153, 153));
lblPIN = new JLabel("<html><font size = 30>Please enter your PIN : ");
lblPIN.setBounds(347, 25, 406, 61);
pfldPIN = new JPasswordField(10);
pfldPIN.setBounds(366, 80, 339, 90);
pfldPIN.setFont(new Font("Tahoma", Font.PLAIN, 44));
pfldPIN.requestFocus(true);
btnOK = new JButton();
btnOK.setBounds(547, 175, 149, 82);
btnOK.setIcon(new ImageIcon("ok.jpg"));
btnClear = new JButton();
btnClear.setIcon(new ImageIcon("clear.jpg"));
btnClear.setBounds(370, 175, 174, 82);
btnClose = new JButton("");
btnClose.setIcon(new ImageIcon("close_button_red.png"));
btnClose.setBounds(879, 441, 141, 135);
lblbg = new JLabel("");
lblbg.setIcon(new ImageIcon("bgatm.jpg"));
lblbg.setBounds(0, 0, 1030, 587);
setTitle("ATM");
setSize(1800, 2500);
setVisible(true);
setResizable(false);
getContentPane().setLayout(null);
getContentPane().add(lblPIN);
getContentPane().add(pfldPIN);
getContentPane().add(btnOK);
getContentPane().add(btnClear);
getContentPane().add(btnClose);
getContentPane().add(lblbg);
btnOK.addActionListener(this);
btnClear.addActionListener(this);
btnClose.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==btnOK)
{
int PIN = Integer.parseInt(pfldPIN.getText());
if(PIN==getPIN())
{
//The ATM Menu
atmmenu panel = new atmmenu();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
int end = JOptionPane.showConfirmDialog(null, "<html><font size = 4><font color = black>Do you want to continue?", null,
JOptionPane.YES_NO_OPTION);
if(end == JOptionPane.YES_OPTION)
{
pfldPIN.setText("");
}
else
{
System.exit(0);
}
}
else{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = red>Invalid PIN!","ATM",JOptionPane.WARNING_MESSAGE);
ctr+=1;
pfldPIN.setText("");
if((ctr>1) && (ctr==2))
{
JOptionPane.showMessageDialog(null, "<html><font size = 3><font color = black>You only have one last try to input your PIN.", "ATM",JOptionPane.WARNING_MESSAGE);
}
if(ctr>2)
{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = black>Captured Card!", "ATM", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
}
}
//For clear button
else if(ae.getSource()==btnClear){
pfldPIN.setText("");
}
//For the close button
else if(ae.getSource()==btnClose){
int exit = JOptionPane.showConfirmDialog(null, "<html><font size = 4><font color = black>Are you sure do you want to exit?", "Exit",
JOptionPane.YES_NO_OPTION);
if(exit == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = black>Thank You for using the System!", "Exit", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
else
{
pfldPIN.setText("");
}
}
}
//menu
public class atmmenu extends JFrame implements ActionListener{
JButton btnBals = new JButton("Balance Inquiry");
JButton btnDep = new JButton("Deposit");
JButton btnWid = new JButton("Withdraw");
JButton btnchpin = new JButton("Change Pin");
JButton btnLogOut = new JButton("EXIT");
public atmmenu() {
super("ATM");
final UIManager UI=new UIManager();
UI.put("OptionPane.background", Color.white);
UI.put("Panel.background", Color.blue);
UI.put("Button.background", Color.orange);
UI.put("TextField.background", new ColorUIResource(255,255,255));
UI.put("OptionPane.buttonFont", new FontUIResource(new Font("ARIAL",Font.PLAIN,41)));
UI.put("OptionPane.minimumSize",new Dimension(1017,570));
JPanel pane = new JPanel();
pane.setForeground(new Color(255, 102, 0));
pane.setBackground(new Color(0, 153, 255));
pane.setLayout(null);
btnBals.setBounds(10, 29, 384, 107);
btnBals.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnBals.setForeground(UIManager.getColor("Button.highlight"));
btnBals.setBackground(new Color(255, 102, 0));
pane.add(btnBals);
btnDep.setBounds(10, 136, 384, 107);
btnDep.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnDep.setForeground(UIManager.getColor("Button.highlight"));
btnDep.setBackground(new Color(255, 102, 0));
pane.add(btnDep);
btnWid.setBounds(10, 242, 384, 107);
btnWid.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnWid.setForeground(UIManager.getColor("Button.highlight"));
btnWid.setBackground(new Color(255, 102, 0));
pane.add(btnWid);
btnLogOut.setBackground(new Color(255, 153, 0));
btnLogOut.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnLogOut.setForeground(UIManager.getColor("Button.highlight"));
btnLogOut.setBounds(705, 364, 277, 96);
pane.add(btnLogOut);
setContentPane(pane);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
btnchpin.setBounds(10, 350, 384, 107);
btnchpin.setForeground(UIManager.getColor("Button.highlight"));
btnchpin.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnchpin.setBackground(new Color(255, 102, 0));
pane.add(btnchpin);
JTextArea txtname = new JTextArea();
txtname.setBounds(671, 61, -248, 310);
pane.add(txtname);
btnBals.addActionListener(this);
btnWid.addActionListener(this);
btnchpin.addActionListener(this);
btnDep.addActionListener(this);
btnLogOut.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==btnBals)
{
bal panel = new bal();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnWid)
{
withdraw panel = new withdraw();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnDep)
{
deposit panel = new deposit();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnchpin)
{
changepin panel = new changepin();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnLogOut)
{
int exit = JOptionPane.showConfirmDialog(null, "<html><font size = 4><font color = black>Are you sure do you want to exit?", "Exit",
JOptionPane.YES_NO_OPTION);
if(exit == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = black>Thank You for using the System!", "Exit", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
}
}
//balance
public class bal extends JFrame{
JButton btnyes1 = new JButton("YES");
JButton btnno1 = new JButton("NO");
public bal() {
JPanel pane1 = new JPanel();
pane1.setForeground(new Color(255, 102, 0));
pane1.setBackground(new Color(0, 153, 255));
pane1.setLayout(null);
btnyes1.setBounds(598, 268, 384, 107);
btnyes1.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes1.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane1.add(btnyes1);
btnyes1.setForeground(UIManager.getColor("Button.highlight"));
btnyes1.setBackground(new Color(255, 102, 0));
btnno1.setBounds(598, 382, 384, 107);
btnno1.setHorizontalAlignment(SwingConstants.RIGHT);
btnno1.setForeground(UIManager.getColor("Button.highlight"));
btnno1.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno1.setBackground(new Color(255, 102, 0));
pane1.add(btnno1);
JLabel lblcrnt = new JLabel("CURRENT:");
lblcrnt.setBounds(33, 61, 216, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lblcrnt);
JLabel lblavl = new JLabel("AVAILABLE:");
lblavl.setBounds(30, 125, 219, 78);
lblavl.setForeground(Color.ORANGE);
lblavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lblavl);
JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setBounds(112, 214, 716, 51);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lblav);
JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setBounds(178, 495, 716, 51);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lbla);
JLabel labela = new JLabel();
labela.setBounds(309, 61, 402, 63);
labela.setForeground(Color.ORANGE);
labela.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(labela);
JLabel labelc = new JLabel();
labelc.setBounds(309, 125, 402, 63);
labelc.setForeground(Color.ORANGE);
labelc.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(labelc);
JLabel ballavl = new JLabel("YOUR BALANCE IS");
ballavl.setBounds(112, 11, 402, 51);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(ballavl);
setContentPane(pane1);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//withdraw
public class withdraw extends JFrame{
JButton btnyes2 = new JButton("YES");
JButton btnno2 = new JButton("NO");
public withdraw() {
final JPanel pane2 = new JPanel();
pane2.setForeground(new Color(255, 102, 0));
pane2.setBackground(new Color(0, 153, 255));
pane2.setLayout(null);
btnyes2.setBounds(686, 353, 296, 70);
btnyes2.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes2.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane2.add(btnyes2);
btnyes2.setBackground(new Color(255, 102, 0));
btnno2.setBounds(686, 425, 296, 78);
btnno2.setHorizontalAlignment(SwingConstants.RIGHT);
btnno2.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno2.setBackground(new Color(255, 102, 0));
pane2.add(btnno2);
final JLabel lblcrnt = new JLabel("AMOUNT TO WITHDRAW");
lblcrnt.setBounds(35, 117, 460, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblcrnt);
final JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setBounds(284, 291, 716, 51);
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblav);
final JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setBounds(444, 500, 384, 51);
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 30));
pane2.add(lbla);
final JLabel ballavl = new JLabel("PLEASE ENTER");
ballavl.setBounds(35, 64, 460, 70);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(ballavl);
final JTextField txtamount = new JTextField();
txtamount.setFont(new Font("Tahoma", Font.BOLD, 20));
txtamount.setBounds(505, 81, 335, 53);
txtamount.requestFocus(true);
pane2.add(txtamount);
txtamount.setColumns(10);
final JButton btnclear = new JButton("CLEAR");
btnclear.setBackground(new Color(255, 165, 0));
btnclear.setFont(new Font("Tahoma", Font.BOLD, 20));
btnclear.setForeground(Color.WHITE);
btnclear.setBounds(505, 145, 165, 41);
pane2.add(btnclear);
final JButton btnconfirm = new JButton("OK");
btnconfirm.setFont(new Font("Tahoma", Font.BOLD, 20));
btnconfirm.setBackground(new Color(255, 165, 0));
btnconfirm.setForeground(Color.WHITE);
btnconfirm.setBounds(675, 145, 165, 41);
pane2.add(btnconfirm);
setContentPane(pane2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//deposit
public class deposit extends JFrame{
JButton btnyes3 = new JButton("YES");
JButton btnno3 = new JButton("NO");
public deposit() {
final JPanel pane2 = new JPanel();
pane2.setForeground(new Color(255, 102, 0));
pane2.setBackground(new Color(0, 153, 255));
pane2.setLayout(null);
btnyes3.setBounds(686, 353, 296, 70);
btnyes3.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes3.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane2.add(btnyes3);
btnyes3.setBackground(new Color(255, 102, 0));
btnno3.setBounds(686, 425, 296, 78);
btnno3.setHorizontalAlignment(SwingConstants.RIGHT);
btnno3.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno3.setBackground(new Color(255, 102, 0));
pane2.add(btnno3);
final JLabel lblcrnt = new JLabel("WANT TO DEPOSIT?");
lblcrnt.setBounds(35, 117, 460, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblcrnt);
final JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setBounds(284, 291, 716, 51);
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblav);
final JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setBounds(444, 500, 384, 51);
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 30));
pane2.add(lbla);
final JLabel ballavl = new JLabel("HOW MUCH DO YOU");
ballavl.setBounds(35, 64, 460, 70);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(ballavl);
final JTextField txtamount = new JTextField();
txtamount.setFont(new Font("Tahoma", Font.BOLD, 20));
txtamount.setBounds(505, 81, 335, 53);
txtamount.requestFocus(true);
pane2.add(txtamount);
txtamount.setColumns(10);
final JButton btnclear = new JButton("CLEAR");
btnclear.setBackground(new Color(255, 165, 0));
btnclear.setFont(new Font("Tahoma", Font.BOLD, 20));
btnclear.setForeground(Color.WHITE);
btnclear.setBounds(505, 145, 165, 41);
pane2.add(btnclear);
final JButton btnconfirm = new JButton("OK");
btnconfirm.setFont(new Font("Tahoma", Font.BOLD, 20));
btnconfirm.setBackground(new Color(255, 165, 0));
btnconfirm.setForeground(Color.WHITE);
btnconfirm.setBounds(675, 145, 165, 41);
pane2.add(btnconfirm);
setContentPane(pane2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//changepin
public class changepin extends JFrame{
JButton btnyes4 = new JButton("YES");
JButton btnno4 = new JButton("NO");
public changepin() {
final JPanel pane2 = new JPanel();
pane2.setForeground(new Color(255, 102, 0));
pane2.setBackground(new Color(0, 153, 255));
pane2.setLayout(null);
btnyes4.setBounds(686, 353, 296, 70);
btnyes4.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes4.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane2.add(btnyes4);
btnyes4.setBackground(new Color(255, 102, 0));
btnno4.setBounds(686, 425, 296, 78);
btnno4.setHorizontalAlignment(SwingConstants.RIGHT);
btnno4.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno4.setBackground(new Color(255, 102, 0));
pane2.add(btnno4);
final JLabel lblcrnt = new JLabel("PIN CODE");
lblcrnt.setBounds(35, 117, 460, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblcrnt);
final JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setBounds(284, 291, 716, 51);
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblav);
final JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setBounds(444, 500, 384, 51);
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 30));
pane2.add(lbla);
final JLabel ballavl = new JLabel("ENTER YOUR CURRENT");
ballavl.setBounds(35, 64, 460, 70);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(ballavl);
final JPasswordField passwordField = new JPasswordField();
passwordField.setFont(new Font("Tahoma", Font.PLAIN, 50));
passwordField.setBounds(505, 64, 335, 70);
pane2.add(passwordField);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JButton btnclear = new JButton("CLEAR");
btnclear.setBackground(new Color(255, 165, 0));
btnclear.setFont(new Font("Tahoma", Font.BOLD, 20));
btnclear.setForeground(Color.WHITE);
btnclear.setBounds(505, 145, 165, 41);
pane2.add(btnclear);
final JButton btnconfirm = new JButton("OK");
btnconfirm.setFont(new Font("Tahoma", Font.BOLD, 20));
btnconfirm.setBackground(new Color(255, 165, 0));
btnconfirm.setForeground(Color.WHITE);
btnconfirm.setBounds(675, 145, 165, 41);
pane2.add(btnconfirm);
setContentPane(pane2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
public static void main(String args[])
{
ATMDesign ATM = new ATMDesign();
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import java.awt.font.*;
import javax.swing.plaf.FontUIResource;
public class ATMDesign extends JFrame implements ActionListener {
JFrame ATMframe = new JFrame("ATM Menu");
int PIN = 1234;
int ctr = 0;
int NewPIN;
double money = 0.0;
JLabel lblPIN, lblbg;
JPasswordField pfldPIN;
JButton btnOK, btnClose, btnClear;
public int getPIN(){
return PIN;
}
public void setPIN(int pn)
{
this.PIN = pn;
}
public void changePIN(int iPIN)
{
setPIN(iPIN);
}
public ATMDesign()
{
UIManager UI=new UIManager();
UI.put("OptionPane.background", Color.white);
UI.put("Panel.background", Color.cyan);
UI.put("Button.background", Color.orange);
UI.put("PasswordField.background", new ColorUIResource(255,255,255));
UI.put("OptionPane.buttonFont", new FontUIResource(new Font("ARIAL",Font.PLAIN,80)));
UI.put("OptionPane.minimumSize",new Dimension(1017,570));
setFont(new Font("Dialog", Font.PLAIN, 70));
setForeground(new Color(0, 153, 153));
lblPIN = new JLabel("<html><font size = 30>Please enter your PIN : ");
lblPIN.setBounds(347, 25, 406, 61);
pfldPIN = new JPasswordField(10);
pfldPIN.setBounds(366, 80, 339, 90);
pfldPIN.setFont(new Font("Tahoma", Font.PLAIN, 44));
pfldPIN.requestFocus(true);
btnOK = new JButton();
btnOK.setBounds(547, 175, 149, 82);
btnOK.setIcon(new ImageIcon("ok.jpg"));
btnClear = new JButton();
btnClear.setIcon(new ImageIcon("clear.jpg"));
btnClear.setBounds(370, 175, 174, 82);
btnClose = new JButton("");
btnClose.setIcon(new ImageIcon("close_button_red.png"));
btnClose.setBounds(879, 441, 141, 135);
lblbg = new JLabel("");
lblbg.setIcon(new ImageIcon("bgatm.jpg"));
lblbg.setBounds(0, 0, 1030, 587);
setTitle("ATM");
setSize(1800, 2500);
setVisible(true);
setResizable(false);
getContentPane().setLayout(null);
getContentPane().add(lblPIN);
getContentPane().add(pfldPIN);
getContentPane().add(btnOK);
getContentPane().add(btnClear);
getContentPane().add(btnClose);
getContentPane().add(lblbg);
btnOK.addActionListener(this);
btnClear.addActionListener(this);
btnClose.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==btnOK)
{
int PIN = Integer.parseInt(pfldPIN.getText());
if(PIN==getPIN())
{
//The ATM Menu
atmmenu panel = new atmmenu();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
int end = JOptionPane.showConfirmDialog(null, "<html><font size = 4><font color = black>Do you want to continue?", null,
JOptionPane.YES_NO_OPTION);
if(end == JOptionPane.YES_OPTION)
{
pfldPIN.setText("");
}
else
{
System.exit(0);
}
}
else{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = red>Invalid PIN!","ATM",JOptionPane.WARNING_MESSAGE);
ctr+=1;
pfldPIN.setText("");
if((ctr>1) && (ctr==2))
{
JOptionPane.showMessageDialog(null, "<html><font size = 3><font color = black>You only have one last try to input your PIN.", "ATM",JOptionPane.WARNING_MESSAGE);
}
if(ctr>2)
{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = black>Captured Card!", "ATM", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
}
}
//For clear button
else if(ae.getSource()==btnClear){
pfldPIN.setText("");
}
//For the close button
else if(ae.getSource()==btnClose){
int exit = JOptionPane.showConfirmDialog(null, "<html><font size = 4><font color = black>Are you sure do you want to exit?", "Exit",
JOptionPane.YES_NO_OPTION);
if(exit == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = black>Thank You for using the System!", "Exit", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
else
{
pfldPIN.setText("");
}
}
}
//menu
public class atmmenu extends JFrame implements ActionListener{
JButton btnBals = new JButton("Balance Inquiry");
JButton btnDep = new JButton("Deposit");
JButton btnWid = new JButton("Withdraw");
JButton btnchpin = new JButton("Change Pin");
JButton btnLogOut = new JButton("EXIT");
public atmmenu() {
super("ATM");
final UIManager UI=new UIManager();
UI.put("OptionPane.background", Color.white);
UI.put("Panel.background", Color.blue);
UI.put("Button.background", Color.orange);
UI.put("TextField.background", new ColorUIResource(255,255,255));
UI.put("OptionPane.buttonFont", new FontUIResource(new Font("ARIAL",Font.PLAIN,41)));
UI.put("OptionPane.minimumSize",new Dimension(1017,570));
JPanel pane = new JPanel();
pane.setForeground(new Color(255, 102, 0));
pane.setBackground(new Color(0, 153, 255));
pane.setLayout(null);
btnBals.setBounds(10, 29, 384, 107);
btnBals.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnBals.setForeground(UIManager.getColor("Button.highlight"));
btnBals.setBackground(new Color(255, 102, 0));
pane.add(btnBals);
btnDep.setBounds(10, 136, 384, 107);
btnDep.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnDep.setForeground(UIManager.getColor("Button.highlight"));
btnDep.setBackground(new Color(255, 102, 0));
pane.add(btnDep);
btnWid.setBounds(10, 242, 384, 107);
btnWid.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnWid.setForeground(UIManager.getColor("Button.highlight"));
btnWid.setBackground(new Color(255, 102, 0));
pane.add(btnWid);
btnLogOut.setBackground(new Color(255, 153, 0));
btnLogOut.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnLogOut.setForeground(UIManager.getColor("Button.highlight"));
btnLogOut.setBounds(705, 364, 277, 96);
pane.add(btnLogOut);
setContentPane(pane);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
btnchpin.setBounds(10, 350, 384, 107);
btnchpin.setForeground(UIManager.getColor("Button.highlight"));
btnchpin.setFont(new Font("Tahoma", Font.PLAIN, 41));
btnchpin.setBackground(new Color(255, 102, 0));
pane.add(btnchpin);
JTextArea txtname = new JTextArea();
txtname.setBounds(671, 61, -248, 310);
pane.add(txtname);
btnBals.addActionListener(this);
btnWid.addActionListener(this);
btnchpin.addActionListener(this);
btnDep.addActionListener(this);
btnLogOut.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==btnBals)
{
bal panel = new bal();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnWid)
{
withdraw panel = new withdraw();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnDep)
{
deposit panel = new deposit();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnchpin)
{
changepin panel = new changepin();
panel.setSize(1200,2100);
panel.setVisible(true);
panel.setResizable(false);
panel.setLocation(null);
dispose();
}
else if(ae.getSource()==btnLogOut)
{
int exit = JOptionPane.showConfirmDialog(null, "<html><font size = 4><font color = black>Are you sure do you want to exit?", "Exit",
JOptionPane.YES_NO_OPTION);
if(exit == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(null, "<html><font size = 4><font color = black>Thank You for using the System!", "Exit", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
}
}
//balance
public class bal extends JFrame{
JButton btnyes1 = new JButton("YES");
JButton btnno1 = new JButton("NO");
public bal() {
JPanel pane1 = new JPanel();
pane1.setForeground(new Color(255, 102, 0));
pane1.setBackground(new Color(0, 153, 255));
pane1.setLayout(null);
btnyes1.setBounds(598, 268, 384, 107);
btnyes1.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes1.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane1.add(btnyes1);
btnyes1.setForeground(UIManager.getColor("Button.highlight"));
btnyes1.setBackground(new Color(255, 102, 0));
btnno1.setBounds(598, 382, 384, 107);
btnno1.setHorizontalAlignment(SwingConstants.RIGHT);
btnno1.setForeground(UIManager.getColor("Button.highlight"));
btnno1.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno1.setBackground(new Color(255, 102, 0));
pane1.add(btnno1);
JLabel lblcrnt = new JLabel("CURRENT:");
lblcrnt.setBounds(33, 61, 216, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lblcrnt);
JLabel lblavl = new JLabel("AVAILABLE:");
lblavl.setBounds(30, 125, 219, 78);
lblavl.setForeground(Color.ORANGE);
lblavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lblavl);
JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setBounds(112, 214, 716, 51);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lblav);
JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setBounds(178, 495, 716, 51);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(lbla);
JLabel labela = new JLabel();
labela.setBounds(309, 61, 402, 63);
labela.setForeground(Color.ORANGE);
labela.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(labela);
JLabel labelc = new JLabel();
labelc.setBounds(309, 125, 402, 63);
labelc.setForeground(Color.ORANGE);
labelc.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(labelc);
JLabel ballavl = new JLabel("YOUR BALANCE IS");
ballavl.setBounds(112, 11, 402, 51);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane1.add(ballavl);
setContentPane(pane1);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//withdraw
public class withdraw extends JFrame{
JButton btnyes2 = new JButton("YES");
JButton btnno2 = new JButton("NO");
public withdraw() {
final JPanel pane2 = new JPanel();
pane2.setForeground(new Color(255, 102, 0));
pane2.setBackground(new Color(0, 153, 255));
pane2.setLayout(null);
btnyes2.setBounds(686, 353, 296, 70);
btnyes2.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes2.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane2.add(btnyes2);
btnyes2.setBackground(new Color(255, 102, 0));
btnno2.setBounds(686, 425, 296, 78);
btnno2.setHorizontalAlignment(SwingConstants.RIGHT);
btnno2.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno2.setBackground(new Color(255, 102, 0));
pane2.add(btnno2);
final JLabel lblcrnt = new JLabel("AMOUNT TO WITHDRAW");
lblcrnt.setBounds(35, 117, 460, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblcrnt);
final JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setBounds(284, 291, 716, 51);
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblav);
final JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setBounds(444, 500, 384, 51);
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 30));
pane2.add(lbla);
final JLabel ballavl = new JLabel("PLEASE ENTER");
ballavl.setBounds(35, 64, 460, 70);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(ballavl);
final JTextField txtamount = new JTextField();
txtamount.setFont(new Font("Tahoma", Font.BOLD, 20));
txtamount.setBounds(505, 81, 335, 53);
txtamount.requestFocus(true);
pane2.add(txtamount);
txtamount.setColumns(10);
final JButton btnclear = new JButton("CLEAR");
btnclear.setBackground(new Color(255, 165, 0));
btnclear.setFont(new Font("Tahoma", Font.BOLD, 20));
btnclear.setForeground(Color.WHITE);
btnclear.setBounds(505, 145, 165, 41);
pane2.add(btnclear);
final JButton btnconfirm = new JButton("OK");
btnconfirm.setFont(new Font("Tahoma", Font.BOLD, 20));
btnconfirm.setBackground(new Color(255, 165, 0));
btnconfirm.setForeground(Color.WHITE);
btnconfirm.setBounds(675, 145, 165, 41);
pane2.add(btnconfirm);
setContentPane(pane2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//deposit
public class deposit extends JFrame{
JButton btnyes3 = new JButton("YES");
JButton btnno3 = new JButton("NO");
public deposit() {
final JPanel pane2 = new JPanel();
pane2.setForeground(new Color(255, 102, 0));
pane2.setBackground(new Color(0, 153, 255));
pane2.setLayout(null);
btnyes3.setBounds(686, 353, 296, 70);
btnyes3.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes3.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane2.add(btnyes3);
btnyes3.setBackground(new Color(255, 102, 0));
btnno3.setBounds(686, 425, 296, 78);
btnno3.setHorizontalAlignment(SwingConstants.RIGHT);
btnno3.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno3.setBackground(new Color(255, 102, 0));
pane2.add(btnno3);
final JLabel lblcrnt = new JLabel("WANT TO DEPOSIT?");
lblcrnt.setBounds(35, 117, 460, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblcrnt);
final JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setBounds(284, 291, 716, 51);
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblav);
final JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setBounds(444, 500, 384, 51);
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 30));
pane2.add(lbla);
final JLabel ballavl = new JLabel("HOW MUCH DO YOU");
ballavl.setBounds(35, 64, 460, 70);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(ballavl);
final JTextField txtamount = new JTextField();
txtamount.setFont(new Font("Tahoma", Font.BOLD, 20));
txtamount.setBounds(505, 81, 335, 53);
txtamount.requestFocus(true);
pane2.add(txtamount);
txtamount.setColumns(10);
final JButton btnclear = new JButton("CLEAR");
btnclear.setBackground(new Color(255, 165, 0));
btnclear.setFont(new Font("Tahoma", Font.BOLD, 20));
btnclear.setForeground(Color.WHITE);
btnclear.setBounds(505, 145, 165, 41);
pane2.add(btnclear);
final JButton btnconfirm = new JButton("OK");
btnconfirm.setFont(new Font("Tahoma", Font.BOLD, 20));
btnconfirm.setBackground(new Color(255, 165, 0));
btnconfirm.setForeground(Color.WHITE);
btnconfirm.setBounds(675, 145, 165, 41);
pane2.add(btnconfirm);
setContentPane(pane2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//changepin
public class changepin extends JFrame{
JButton btnyes4 = new JButton("YES");
JButton btnno4 = new JButton("NO");
public changepin() {
final JPanel pane2 = new JPanel();
pane2.setForeground(new Color(255, 102, 0));
pane2.setBackground(new Color(0, 153, 255));
pane2.setLayout(null);
btnyes4.setBounds(686, 353, 296, 70);
btnyes4.setHorizontalAlignment(SwingConstants.RIGHT);
btnyes4.setFont(new Font("Tahoma", Font.PLAIN, 55));
pane2.add(btnyes4);
btnyes4.setBackground(new Color(255, 102, 0));
btnno4.setBounds(686, 425, 296, 78);
btnno4.setHorizontalAlignment(SwingConstants.RIGHT);
btnno4.setFont(new Font("Tahoma", Font.PLAIN, 55));
btnno4.setBackground(new Color(255, 102, 0));
pane2.add(btnno4);
final JLabel lblcrnt = new JLabel("PIN CODE");
lblcrnt.setBounds(35, 117, 460, 78);
lblcrnt.setForeground(Color.ORANGE);
lblcrnt.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblcrnt);
final JLabel lblav = new JLabel("PERFORM ANOTHER TRANSACTION?");
lblav.setBounds(284, 291, 716, 51);
lblav.setVerticalAlignment(SwingConstants.TOP);
lblav.setForeground(Color.ORANGE);
lblav.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(lblav);
final JLabel lbla = new JLabel("TRANSACTION COMPLETED");
lbla.setBounds(444, 500, 384, 51);
lbla.setVerticalAlignment(SwingConstants.TOP);
lbla.setForeground(Color.ORANGE);
lbla.setFont(new Font("Tahoma", Font.PLAIN, 30));
pane2.add(lbla);
final JLabel ballavl = new JLabel("ENTER YOUR CURRENT");
ballavl.setBounds(35, 64, 460, 70);
ballavl.setForeground(Color.ORANGE);
ballavl.setFont(new Font("Tahoma", Font.PLAIN, 40));
pane2.add(ballavl);
final JPasswordField passwordField = new JPasswordField();
passwordField.setFont(new Font("Tahoma", Font.PLAIN, 50));
passwordField.setBounds(505, 64, 335, 70);
pane2.add(passwordField);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JButton btnclear = new JButton("CLEAR");
btnclear.setBackground(new Color(255, 165, 0));
btnclear.setFont(new Font("Tahoma", Font.BOLD, 20));
btnclear.setForeground(Color.WHITE);
btnclear.setBounds(505, 145, 165, 41);
pane2.add(btnclear);
final JButton btnconfirm = new JButton("OK");
btnconfirm.setFont(new Font("Tahoma", Font.BOLD, 20));
btnconfirm.setBackground(new Color(255, 165, 0));
btnconfirm.setForeground(Color.WHITE);
btnconfirm.setBounds(675, 145, 165, 41);
pane2.add(btnconfirm);
setContentPane(pane2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
public static void main(String args[])
{
ATMDesign ATM = new ATMDesign();
}
}