您好,登錄后才能下訂單哦!
這篇文章給大家介紹使用java編寫一個(gè)銀行管理系統(tǒng),內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。
package org.vector.view; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPasswordField; import javax.swing.JTextField; import org.vector.bean.Bank; import org.vector.serviceImpl.BankServiceImpl; @SuppressWarnings("serial") public class BankView extends JFrame{ private JButton register,login,codeChange; private JLabel idLabel,codeLabel,bank,imLabel; public static JTextField idTest; private JPasswordField codeTest; public static String message; public BankView() { building(); addListeners(); } public void building() { setLayout(null); ImageIcon image = new ImageIcon("bank.png"); imLabel = new JLabel(image); imLabel.setBounds(180, 90, 250, 200); bank = new JLabel("bank"); idLabel = new JLabel("賬號(hào)"); codeLabel = new JLabel("密碼"); register = new JButton("注冊(cè)"); login = new JButton("登錄"); image = new ImageIcon("bank.png"); idTest = new JTextField(20); codeTest = new JPasswordField(20); codeChange = new JButton("修改/忘記密碼"); bank.setBounds(250, 20, 120, 50); Font font = new Font("圓體", Font.BOLD, 50); Font font1 = new Font("圓體", Font.BOLD, 30); bank.setFont(font); register.setBounds(0, 500, 120, 25); login.setBounds(225, 450, 120, 25); codeChange.setBounds(450, 500, 120, 25); idLabel.setBounds(150, 300, 120, 25); idLabel.setFont(font1); codeLabel.setBounds(150, 375, 120, 25); codeLabel.setFont(font1); idTest.setBounds(250, 300, 200, 30); codeTest.setBounds(250, 375, 200, 30); add(bank); add(imLabel); add(idLabel); add(idTest); add(codeLabel); add(codeTest); add(login); add(register); add(codeChange); setBounds(600,600,600,600); setLocation((2000-getWidth())/2,(1000-getHeight())/2); setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setVisible(true); } private void addListeners() { register.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { BankView.this.dispose(); new BankRegister().setVisible(true); } }); login.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub int flag = 0; String id = idTest.getText(); String code = codeTest.getText(); if(!id.equals("")&&!code.equals("")) { BankServiceImpl bankServiceImpl = new BankServiceImpl(); BankView_0.list.clear(); BankView_0.list.addAll(bankServiceImpl.find()); for (int i = 0; i < BankView_0.list.size(); i++) { if(id.equals(BankView_0.list.get(i).getIdAccount()) && code.equals(BankView_0.list.get(i).getCode())) { BankView_0.list1.clear(); BankView_0.list1.add(id); flag = 1; JOptionPane.showMessageDialog(register, "登陸成功", "標(biāo)題",JOptionPane.WARNING_MESSAGE); BankView.this.dispose(); new BankView_0().setVisible(true); break; } } if(flag == 0){ JOptionPane.showMessageDialog(register, "賬號(hào)或密碼錯(cuò)誤", "標(biāo)題",JOptionPane.WARNING_MESSAGE); } } else { JOptionPane.showMessageDialog(register, "賬號(hào)或密碼不能為空", "標(biāo)題",JOptionPane.WARNING_MESSAGE); } } }); codeChange.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub JOptionPane.showMessageDialog(codeChange, "此功能暫未開放", "標(biāo)題",JOptionPane.WARNING_MESSAGE); } }); } }
具體的MVC,已經(jīng)在上一個(gè)項(xiàng)目中介紹了??梢钥磮D書管理系統(tǒng)。這個(gè)項(xiàng)目。
登陸成功!
存款,取款,轉(zhuǎn)賬之前跳轉(zhuǎn)的頁面
存款后的金額改變了
轉(zhuǎn)賬成功!
轉(zhuǎn)賬后的金額
關(guān)于使用java編寫一個(gè)銀行管理系統(tǒng)就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。