基于java实现简单的银行管理系统
程序员文章站
2022-11-02 08:59:06
页面代码之一:package org.vector.view;import java.awt.font;import java.awt.event.actionevent;import java.aw...
页面代码之一:
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("账号"); codelabel = new jlabel("密码"); register = new jbutton("注册"); 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, "登陆成功", "标题",joptionpane.warning_message); bankview.this.dispose(); new bankview_0().setvisible(true); break; } } if(flag == 0){ joptionpane.showmessagedialog(register, "账号或密码错误", "标题",joptionpane.warning_message); } } else { joptionpane.showmessagedialog(register, "账号或密码不能为空", "标题",joptionpane.warning_message); } } }); codechange.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { // todo auto-generated method stub joptionpane.showmessagedialog(codechange, "此功能暂未开放", "标题",joptionpane.warning_message); } }); } }
mvc设计模式,分包
分包图片
具体的mvc,已经在上一个项目中介绍了。可以看图书管理系统。这个项目。
简单效果演示:
登陆主页面
注册页面
登录:
登陆成功!
功能页面!
存款,取款,转账之前跳转的页面
存款
存款后的金额改变了
转账
转账成功!
转账后的金额
查看近期流水账单!
到此这篇关于基于java实现简单的银行管理系统的文章就介绍到这了,更多相关java银行管理系统内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
推荐阅读