diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..20ec589 Binary files /dev/null and b/.DS_Store differ diff --git a/Bankingsystem/CreateAcc.class b/Bankingsystem/CreateAcc.class new file mode 100755 index 0000000..4151147 Binary files /dev/null and b/Bankingsystem/CreateAcc.class differ diff --git a/Bankingsystem/CreateAcc.java b/Bankingsystem/CreateAcc.java new file mode 100755 index 0000000..de7e41f --- /dev/null +++ b/Bankingsystem/CreateAcc.java @@ -0,0 +1,214 @@ +import java.awt.*; +import java.awt.event.*; +import java.sql.*; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JTextField; +import javax.swing.border.EmptyBorder; +import javax.swing.*; +import java.util.*; +import java.lang.*; + +class CreateAcc extends JFrame implements ActionListener { + + + public static void main(String[] args) { + try { + CreateAcc frame = new CreateAcc(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + private JPanel contentPanel; + public JTextField fName,accNo,address,pNo; + public JComboBox type; + JCheckBox subject1,subject2,subject3; + JRadioButton male,female; + ButtonGroup bg; + JButton submit; + + + + CreateAcc(){ + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(450, 190, 1014, 597); + setResizable(false); + contentPanel = new JPanel(); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPanel); + contentPanel.setLayout(null); + + //********************LABELS************************ + + JLabel lblNewLabel = new JLabel("Create Account"); + lblNewLabel.setForeground(Color.BLACK); + lblNewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 46)); + lblNewLabel.setBounds(423, 10, 273, 93); + contentPanel.add(lblNewLabel); + + + + JLabel lb2NewLabel = new JLabel("Acc_no"); + lb2NewLabel.setForeground(Color.BLACK); + lb2NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb2NewLabel.setBounds(20, 150, 100, 30); + contentPanel.add(lb2NewLabel); + + + + JLabel lb3NewLabel = new JLabel("Name"); + lb3NewLabel.setForeground(Color.BLACK); + lb3NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb3NewLabel.setBounds(20, 200, 100, 30); + contentPanel.add(lb3NewLabel); + + JLabel lb4NewLabel = new JLabel("Address"); + lb4NewLabel.setForeground(Color.BLACK); + lb4NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb4NewLabel.setBounds(20, 250, 100, 30); + contentPanel.add(lb4NewLabel); + + + JLabel lb5NewLabel = new JLabel("PhNo"); + lb5NewLabel.setForeground(Color.BLACK); + lb5NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb5NewLabel.setBounds(20, 300, 100, 30); + contentPanel.add(lb5NewLabel); + + + + JLabel lb6NewLabel = new JLabel("Type"); + lb6NewLabel.setForeground(Color.BLACK); + lb6NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb6NewLabel.setBounds(20, 350, 100, 30); + contentPanel.add(lb6NewLabel); + + + + + + + + + + + //********************TextFields************************ + + + accNo = new JTextField(); + accNo.setFont(new Font("Tahoma", Font.PLAIN, 14)); + accNo.setBounds(100, 150, 150, 30); + contentPanel.add(accNo); + accNo.setColumns(15); + + fName = new JTextField(); + fName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + fName.setBounds(100, 200, 150, 30); + contentPanel.add(fName); + fName.setColumns(15); + + + address = new JTextField(); + address.setFont(new Font("Tahoma", Font.PLAIN, 14)); + address.setBounds(100, 250, 150, 30); + contentPanel.add(address); + address.setColumns(15); + + + pNo = new JTextField(); + pNo.setFont(new Font("Tahoma", Font.PLAIN, 14)); + pNo.setBounds(100, 300, 150, 30); + contentPanel.add(pNo); + pNo.setColumns(15); + +// ***********************ComboBox********************** + + + String s1[] = { "C", "S"}; + + + type = new JComboBox(s1); + type.setFont(new Font("Tahoma", Font.PLAIN, 14)); + type.setBounds(100, 350, 150, 30); + contentPanel.add(type); + + + + + + + + + submit=new JButton("Submit"); + submit.setForeground(Color.BLACK); + submit.setFont(new Font("Times New Roman", Font.PLAIN, 30)); + submit.setBounds(400, 250, 150, 30); + contentPanel.add(submit); + + + submit.addActionListener(this); + + + + } + + public void actionPerformed(ActionEvent ae){ + String fName=this.fName.getText(); + int accNo=Integer.parseInt(this.accNo.getText()); + String address=this.address.getText(); + + String pNo=this.pNo.getText(); + + String type=this.type.getSelectedItem().toString(); + System.out.println(fName); + System.out.println(accNo); + System.out.println(address); + System.out.println(type); + + + + try { + Connection connection = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/bank","root", "root123"); + + PreparedStatement st = (PreparedStatement) connection.prepareStatement("Insert into accopen values(?,?,?,?,?,?)"); + + st.setInt(1, accNo); + st.setString(2, ); + st.setString(3,fName ); + st.setString(4,address ); + st.setInt(5,type ); + st.setString(6,pNo ); + + ResultSet rs = st.executeQuery(); + if (rs.next()) { + dispose(); + + new Menu(); + + + } else { + JOptionPane.showMessageDialog(btnNewButton, "Something went wrong"); + } + } catch (SQLException sqlException) { + sqlException.printStackTrace(); + } + + + + + + + } + + + +} + diff --git a/Bankingsystem/Menu$1.class b/Bankingsystem/Menu$1.class new file mode 100755 index 0000000..50f5e81 Binary files /dev/null and b/Bankingsystem/Menu$1.class differ diff --git a/Bankingsystem/Menu.class b/Bankingsystem/Menu.class new file mode 100755 index 0000000..4ca915e Binary files /dev/null and b/Bankingsystem/Menu.class differ diff --git a/Bankingsystem/Menu.java b/Bankingsystem/Menu.java new file mode 100755 index 0000000..befa084 --- /dev/null +++ b/Bankingsystem/Menu.java @@ -0,0 +1,59 @@ + +import javax.swing.*; +import java.util.*; +import java.io.*; +import java.lang.*; +import java.awt.event.*; + +class Menu extends JFrame +{ + JMenu menu,master,transaction; + JMenuItem i1, i2, i3; + Menu() + { + JFrame f= new JFrame("Menu"); + JMenuBar mb=new JMenuBar(); + menu=new JMenu("Menu"); + master=new JMenu("Master"); + transaction=new JMenu("Transaction"); + i1=new JMenuItem("Open acc"); + i2=new JMenuItem("Deposit"); + i3=new JMenuItem("Withdraw"); + menu.add(master); + menu.add(transaction); + master.add(i1); + transaction.add(i2); + transaction.add(i3); + + + i1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + System.out.println("i1"); + } + }); + i2.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + System.out.println("i2"); + } + }); + i3.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + System.out.println("i3"); + } + }); + + + mb.add(menu); + f.setJMenuBar(mb); + f.setSize(400,400); + f.setLayout(null); + f.setVisible(true); + } + + + + public static void main(String args[]) + { + Menu m= new Menu(); + } +} \ No newline at end of file diff --git a/Bankingsystem/MenuEg1.class b/Bankingsystem/MenuEg1.class new file mode 100755 index 0000000..4d9627e Binary files /dev/null and b/Bankingsystem/MenuEg1.class differ diff --git a/Bankingsystem/Registration.class b/Bankingsystem/Registration.class new file mode 100755 index 0000000..f248712 Binary files /dev/null and b/Bankingsystem/Registration.class differ diff --git a/Bankingsystem/UserLogin$1.class b/Bankingsystem/UserLogin$1.class new file mode 100755 index 0000000..4c64268 Binary files /dev/null and b/Bankingsystem/UserLogin$1.class differ diff --git a/Bankingsystem/UserLogin.class b/Bankingsystem/UserLogin.class new file mode 100755 index 0000000..95d7bce Binary files /dev/null and b/Bankingsystem/UserLogin.class differ diff --git a/Bankingsystem/UserLogin.java b/Bankingsystem/UserLogin.java new file mode 100755 index 0000000..b3d388e --- /dev/null +++ b/Bankingsystem/UserLogin.java @@ -0,0 +1,134 @@ + +import java.awt.Color; +import java.awt.*; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.*; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JTextField; +import javax.swing.border.EmptyBorder; +import javax.swing.*; + +public class UserLogin extends JFrame +{ + + private JTextField textField; + private JPasswordField passwordField; + private JButton btnNewButton; + private JLabel label; + private JPanel contentPane; + + + public static void main(String[] args) +{ + + + try { + UserLogin frame = new UserLogin(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + /** + * Create the frame. + */ + public UserLogin() + { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(450, 190, 1014, 597); + setResizable(false); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + + JLabel lblNewLabel = new JLabel("Login"); + lblNewLabel.setForeground(Color.BLACK); + lblNewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 46)); + lblNewLabel.setBounds(423, 13, 273, 93); + contentPane.add(lblNewLabel); + + textField = new JTextField(); + textField.setFont(new Font("Tahoma", Font.PLAIN, 32)); + textField.setBounds(481, 170, 281, 68); + textField.setColumns(10); + contentPane.add(textField); + + passwordField = new JPasswordField(); + passwordField.setFont(new Font("Tahoma", Font.PLAIN, 32)); + passwordField.setBounds(481, 286, 281, 68); + contentPane.add(passwordField); + + JLabel lblUsername = new JLabel("Username"); + lblUsername.setBackground(Color.BLACK); + lblUsername.setForeground(Color.BLACK); + lblUsername.setFont(new Font("Tahoma", Font.PLAIN, 31)); + lblUsername.setBounds(250, 166, 193, 52); + contentPane.add(lblUsername); + + JLabel lblPassword = new JLabel("Password"); + lblPassword.setForeground(Color.BLACK); + lblPassword.setBackground(Color.CYAN); + lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 31)); + lblPassword.setBounds(250, 286, 193, 52); + contentPane.add(lblPassword); + + btnNewButton = new JButton("Login"); + btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 26)); + btnNewButton.setBounds(545, 392, 162, 73); + + btnNewButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) + { + String userName = textField.getText(); + String password = passwordField.getText(); + try { + Connection connection = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/bank", + "root", "root123"); + + PreparedStatement st = (PreparedStatement) connection + .prepareStatement("Select * from login where username=? and password=?"); + + st.setString(1, userName); + st.setString(2, password); + ResultSet rs = st.executeQuery(); + if (rs.next()) { + dispose(); + + new Menu(); + + // this.dispose(); + JOptionPane.showMessageDialog(btnNewButton, "You have successfully logged in"); + } else { + JOptionPane.showMessageDialog(btnNewButton, "Wrong Username & Password"); + } + } catch (SQLException sqlException) { + sqlException.printStackTrace(); + } + } + }); + + contentPane.add(btnNewButton); + + label = new JLabel(""); + label.setBounds(0, 0, 1008, 562); + contentPane.add(label); + } +} \ No newline at end of file diff --git a/Bankingsystem/deposit.class b/Bankingsystem/deposit.class new file mode 100755 index 0000000..51a0f65 Binary files /dev/null and b/Bankingsystem/deposit.class differ diff --git a/Bankingsystem/deposit.java b/Bankingsystem/deposit.java new file mode 100755 index 0000000..7b5a885 --- /dev/null +++ b/Bankingsystem/deposit.java @@ -0,0 +1,168 @@ +import java.awt.*; +import java.awt.event.*; +import java.sql.*; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JTextField; +import javax.swing.border.EmptyBorder; +import javax.swing.*; + +class deposit extends JFrame implements ActionListener { + + + public static void main(String[] args) { + try { + deposit frame = new deposit(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + private JPanel contentPanel; + public JTextField fName,accNo,amount,pNo; + public JComboBox type; + JCheckBox subject1,subject2,subject3; + JRadioButton male,female; + ButtonGroup bg; + JButton submit; + + + + deposit(){ + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(450, 190, 1014, 597); + setResizable(false); + contentPanel = new JPanel(); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPanel); + contentPanel.setLayout(null); + + //********************LABELS************************ + + JLabel lblNewLabel = new JLabel("Deposit"); + lblNewLabel.setForeground(Color.BLACK); + lblNewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 46)); + lblNewLabel.setBounds(423, 10, 273, 93); + contentPanel.add(lblNewLabel); + + + + JLabel lb2NewLabel = new JLabel("Acc_no"); + lb2NewLabel.setForeground(Color.BLACK); + lb2NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb2NewLabel.setBounds(20, 150, 100, 30); + contentPanel.add(lb2NewLabel); + + + + JLabel lb3NewLabel = new JLabel("Name"); + lb3NewLabel.setForeground(Color.BLACK); + lb3NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb3NewLabel.setBounds(20, 200, 100, 30); + contentPanel.add(lb3NewLabel); + + JLabel lb4NewLabel = new JLabel("Amount"); + lb4NewLabel.setForeground(Color.BLACK); + lb4NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb4NewLabel.setBounds(20, 250, 100, 30); + contentPanel.add(lb4NewLabel); + + + + //********************TextFields************************ + + + accNo = new JTextField(); + accNo.setFont(new Font("Tahoma", Font.PLAIN, 14)); + accNo.setBounds(100, 150, 150, 30); + contentPanel.add(accNo); + accNo.setColumns(15); + + fName = new JTextField(); + fName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + fName.setBounds(100, 200, 150, 30); + contentPanel.add(fName); + fName.setColumns(15); + + + amount = new JTextField(); + amount.setFont(new Font("Tahoma", Font.PLAIN, 14)); + amount.setBounds(100, 250, 150, 30); + contentPanel.add(amount); + amount.setColumns(15); + + + + + submit=new JButton("Submit"); + submit.setForeground(Color.BLACK); + submit.setFont(new Font("Times New Roman", Font.PLAIN, 30)); + submit.setBounds(400, 250, 150, 30); + contentPanel.add(submit); + + + submit.addActionListener(this); + + + + } + + public void actionPerformed(ActionEvent ae){ + String fName=this.fName.getText(); + int accNo=Integer.parseInt(this.accNo.getText()); + String amount=this.amount.getText(); + + + + + System.out.println(fName); + System.out.println(accNo); + System.out.println(amount); + + + + + try { + Connection connection = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/bank","root", "root123"); + + PreparedStatement st = (PreparedStatement) connection.prepareStatement("Insert into deposit values(?,?,?,?)"); + + st.setInt(1, accNo); + st.setString(2, ); + st.setString(3,fName ); + st.setString(4,amount ); + + + ResultSet rs = st.executeQuery(); + if (rs.next()) { + dispose(); + + new Menu(); + + // this.dispose(); + + } else { + JOptionPane.showMessageDialog(btnNewButton, "Something went wrong"); + } + } catch (SQLException sqlException) { + sqlException.printStackTrace(); + } + + + + + + + } + + + +} + diff --git a/Bankingsystem/withdraw.class b/Bankingsystem/withdraw.class new file mode 100755 index 0000000..0d70040 Binary files /dev/null and b/Bankingsystem/withdraw.class differ diff --git a/Bankingsystem/withdraw.java b/Bankingsystem/withdraw.java new file mode 100755 index 0000000..491931f --- /dev/null +++ b/Bankingsystem/withdraw.java @@ -0,0 +1,168 @@ +import java.awt.*; +import java.awt.event.*; +import java.sql.*; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JTextField; +import javax.swing.border.EmptyBorder; +import javax.swing.*; + +class withdraw extends JFrame implements ActionListener { + + + public static void main(String[] args) { + try { + withdraw frame = new withdraw(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + private JPanel contentPanel; + public JTextField fName,accNo,amount,pNo; + public JComboBox type; + JCheckBox subject1,subject2,subject3; + JRadioButton male,female; + ButtonGroup bg; + JButton submit; + + + + withdraw(){ + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(450, 190, 1014, 597); + setResizable(false); + contentPanel = new JPanel(); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPanel); + contentPanel.setLayout(null); + + //********************LABELS************************ + + JLabel lblNewLabel = new JLabel("withdraw"); + lblNewLabel.setForeground(Color.BLACK); + lblNewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 46)); + lblNewLabel.setBounds(423, 10, 273, 93); + contentPanel.add(lblNewLabel); + + + + JLabel lb2NewLabel = new JLabel("Acc_no"); + lb2NewLabel.setForeground(Color.BLACK); + lb2NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb2NewLabel.setBounds(20, 150, 100, 30); + contentPanel.add(lb2NewLabel); + + + + JLabel lb3NewLabel = new JLabel("Name"); + lb3NewLabel.setForeground(Color.BLACK); + lb3NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb3NewLabel.setBounds(20, 200, 100, 30); + contentPanel.add(lb3NewLabel); + + JLabel lb4NewLabel = new JLabel("Amount"); + lb4NewLabel.setForeground(Color.BLACK); + lb4NewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14)); + lb4NewLabel.setBounds(20, 250, 100, 30); + contentPanel.add(lb4NewLabel); + + + + //********************TextFields************************ + + + accNo = new JTextField(); + accNo.setFont(new Font("Tahoma", Font.PLAIN, 14)); + accNo.setBounds(100, 150, 150, 30); + contentPanel.add(accNo); + accNo.setColumns(15); + + fName = new JTextField(); + fName.setFont(new Font("Tahoma", Font.PLAIN, 14)); + fName.setBounds(100, 200, 150, 30); + contentPanel.add(fName); + fName.setColumns(15); + + + amount = new JTextField(); + amount.setFont(new Font("Tahoma", Font.PLAIN, 14)); + amount.setBounds(100, 250, 150, 30); + contentPanel.add(amount); + amount.setColumns(15); + + + + + submit=new JButton("Submit"); + submit.setForeground(Color.BLACK); + submit.setFont(new Font("Times New Roman", Font.PLAIN, 30)); + submit.setBounds(400, 250, 150, 30); + contentPanel.add(submit); + + + submit.addActionListener(this); + + + + } + + public void actionPerformed(ActionEvent ae){ + String fName=this.fName.getText(); + int accNo=Integer.parseInt(this.accNo.getText()); + String amount=this.amount.getText(); + + + + + System.out.println(fName); + System.out.println(accNo); + System.out.println(amount); + + + + + try { + Connection connection = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/bank","root", "root123"); + + PreparedStatement st = (PreparedStatement) connection.prepareStatement("Insert into withdraw values(?,?,?,?)"); + + st.setInt(1, accNo); + st.setString(2, ); + st.setString(3,fName ); + st.setString(4,amount ); + + + ResultSet rs = st.executeQuery(); + if (rs.next()) { + dispose(); + + new Menu(); + + // this.dispose(); + + } else { + JOptionPane.showMessageDialog(btnNewButton, "Something went wrong"); + } + } catch (SQLException sqlException) { + sqlException.printStackTrace(); + } + + + + + + + } + + + +} +