package xxx;
//import xxx.Withdraw.BHandler;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class Menu extends JFrame {
static JFrame z=new JFrame("银行管理系统");
public Menu(){
z.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
z.setBounds(200,100,700,600);
z.setVisible(true);
z.setResizable(false);
z.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);//窗口不能关闭
Container c=getContentPane();
c.setLayout(null);
c.setBackground(Color.pink);
z.add(c);
JLabel label1=new JLabel("个人账户");
JLabel label2=new JLabel("请选择您的业务");
label1.setFont(new Font("Serif",Font.BOLD,40));
label1.setForeground(Color.WHITE);
label2.setFont(new Font("Serif",Font.BOLD,35));
label2.setForeground(Color.WHITE);
JButton button1=new JButton("取 款");
JButton button2=new JButton("修改密码");
JButton button3=new JButton("存 款");
JButton button4=new JButton("显示余额");
JButton button5=new JButton("转 账");
JButton button6=new JButton("查询修改");
JButton button7=new JButton("退 出");
JButton button8=new JButton("注 销");
JButton button9=new JButton("交易明细");
BHandler h=new BHandler();
button1.addActionListener(h);
button2.addActionListener(h);
button3.addActionListener(h);
button4.addActionListener(h);
button5.addActionListener(h);
button6.addActionListener(h);
button7.addActionListener(h);
button8.addActionListener(h);
button9.addActionListener(h);
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JPanel p3=new JPanel();
JPanel p4=new JPanel();
JPanel p5=new JPanel();
JPanel p6=new JPanel();
JPanel p7=new JPanel();
JPanel p8=new JPanel();
JPanel p9=new JPanel();
JPanel p10=new JPanel();
p1.setBounds(0,0,700,70);
p1.setBackground(Color.pink);
p1.add(label1);
p2.setBounds(0,70,350,100);
p2.setBackground(Color.pink);
p2.add(label2);
p3.setBounds(0,170,200,80);
p3.setBackground(Color.pink);
p3.add(button1);
p4.setBounds(500,170,200,80);
p4.setBackground(Color.pink);
p4.add(button2);
p5.setBounds(0,250,200,80);
p5.setBackground(Color.pink);
p5.add(button3);
p6.setBounds(500,250,200,80);
p6.setBackground(Color.pink);
p6.add(button4);
p7.setBounds(0,330,200,80);
p7.setBackground(Color.pink);
p7.add(button5);
p8.setBounds(500,330,200,150);
p8.setBackground(Color.pink);
p8.add(button6);
p9.setBounds(0,480,700,50);
p9.setBackground(Color.pink);
p9.add(button7);
p9.add(button8);
p10.setBounds(250,250,200,80);
p10.setBackground(Color.pink);
p10.add(button9);
c.add(p1);
c.add(p2);
c.add(p3);
c.add(p4);
c.add(p5);
c.add(p6);
c.add(p7);
c.add(p8);
c.add(p9);
c.add(p10);
z.setVisible(true);
}
public static void close(){
HomePage.weiyi=false;
z.dispose();
}
public static int delete(String id){
long a=Display.getBalance();
if(a==0){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/bank","root","");
Statement stmt=conn.createStatement();
String sql="delete from user where card_no='"+id+"'";
stmt.executeUpdate(sql);
stmt.close();
conn.close();
return 1;
}
catch(Exception sqle){
System.err.println(sqle);
return 3;
}
}
else
return 2;
}
public class BHandler implements ActionListener {
public void actionPerformed (ActionEvent event) {
if(event.getActionCommand()=="取 款")
new Withdraw(z,"取款业务");
else if(event.getActionCommand()=="修改密码")
new ModifyPassword(z,"修改密码");
else if(event.getActionCommand()=="存 款")
new Deposit(z,"存款业务");
else if(event.getActionCommand()=="显示余额")
new Display(z,"显示余额");
else if(event.getActionCommand()=="转 账")
new Transfer(z,"转账业务");
else if(event.getActionCommand()=="查询修改")
new SelectModify(z,"查询修改");
else if(event.getActionCommand()=="交易明细")
new TransactionDetails(z,"交易明细");
else if(event.getActionCommand()=="退 出"){
HomePage.weiyi=false;
z.dispose();
}
else if(event.getActionCommand()=="注 销"){
int b=Menu.delete(HomePage.card_id.getText());
if(b==1){
HomePage.weiyi=false;
JOptionPane.showMessageDialog(Menu.this,"注销成功!");
z.dispose();
}
else if(b==2)
JOptionPane.showMessageDialog(Menu.this,"请取出剩余的钱在注销!");
else
JOptionPane.showMessageDialog(Menu.this,"出错!");
}
}
}
}
Java银行管理系统代码+mysql+uml
需积分: 42 55 浏览量
2018-12-18
22:03:39
上传
评论 13
收藏 101KB RAR 举报
呐呐丶
- 粉丝: 4
- 资源: 4
最新资源
- 杨辉三角(Pascal's Triangle)是一个在数学中非常著名的数列,它以一种特定的模式排列数字,内容以5种代码实例实现
- yolov5数据集:CT图像肾脏、结石检测(2类别,包含训练集、验证集)
- 电力102规约请求报文实录
- RTL8723 linux+安卓驱动 2020版本
- ISO 26262 道路车辆-功能安全-系统级产品开发
- 数据挖掘期末题 选择填空简答
- EKF在CTRV模型上的建模推导
- 用于:https://laoshifu.blog.csdn.net/article/details/138191428 多层创建
- 电力102规约(电能累计量的传输规约)培训
- 「常用」E9外部流程接口
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈