ATM取款系统

  • q7_382181
    了解作者
  • 404.1KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-04 19:16
    上传日期
这个是用java开发的ATM很好用的!
源文件.rar
内容介绍
package atm; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2007</p> * <p>Company: </p> * @author not attributable * @version 1.0 */ public class MainFrame extends JFrame { /** * 存储输入错误的次数 */ int n = 0; int y = 0; int h = 0; static JPanel contentPane; JMenuBar jMenuBar1 = new JMenuBar(); JMenu jMenu1 = new JMenu(); JMenuItem jMenuItem1 = new JMenuItem(); JMenuItem jMenuItem2 = new JMenuItem(); JMenuItem jMenuItem3 = new JMenuItem(); JMenuItem jMenuItem4 = new JMenuItem(); JMenuItem jMenuItem6 = new JMenuItem(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JMenu jMenu3 = new JMenu(); JMenuItem jMenuItem8 = new JMenuItem(); JMenu jMenu2 = new JMenu(); JMenuItem jMenuItem5 = new JMenuItem(); JMenuItem jMenuItem9 = new JMenuItem(); JMenuItem jMenuItem10 = new JMenuItem(); JMenuItem jMenuItem11 = new JMenuItem(); JMenuItem jMenuItem7 = new JMenuItem(); JMenuItem jMenuItem12 = new JMenuItem(); JMenuItem jMenuItem13 = new JMenuItem(); JLabel jLabel3 = new JLabel(new ImageIcon("Image\\blue.jpg")); //Construct the frame public MainFrame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch (Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { this.setIconImage(Toolkit.getDefaultToolkit().getImage("")); contentPane = (JPanel)this.getContentPane(); contentPane.setLayout(null); this.setSize(new Dimension(600, 450)); this.setTitle("S B 银 行 交 易 系 统 V 1.1"); jMenu1.setBackground(Color.blue); jMenu1.setForeground(Color.white); jMenu1.setText("帐户管理"); jMenuItem1.setText("取 款"); jMenuItem1.addActionListener(new MainFrame_jMenuItem1_actionAdapter(this)); jMenuItem2.setText("存 款"); jMenuItem2.addActionListener(new MainFrame_jMenuItem2_actionAdapter(this)); jMenuItem3.setText("余额查询"); jMenuItem3.addActionListener(new MainFrame_jMenuItem3_actionAdapter(this)); jMenuItem4.setText("修改密码"); jMenuItem4.addActionListener(new MainFrame_jMenuItem4_actionAdapter(this)); jMenuItem6.setText("退出系统"); jMenuItem6.addActionListener(new MainFrame_jMenuItem6_actionAdapter(this)); jLabel1.setFont(new java.awt.Font("Dialog", 0, 30)); jLabel1.setForeground(SystemColor.activeCaptionText); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText("欢 迎 使 用 S B 银 行 交 易 系 统"); jLabel1.setBounds(new Rectangle(62, 104, 476, 93)); jLabel2.setFont(new java.awt.Font("Dialog", 0, 12)); jLabel2.setForeground(SystemColor.activeCaptionText); jLabel2.setText("服务QQ:306905603(左岸)"); jLabel2.setBounds(new Rectangle(210, 194, 181, 38)); jMenu3.setBackground(Color.blue); jMenu3.setForeground(Color.white); jMenu3.setText("柜台操作"); jMenuItem8.setText("业务办理"); jMenuItem8.addActionListener(new MainFrame_jMenuItem8_actionAdapter(this)); jMenu2.setBackground(Color.blue); jMenu2.setForeground(Color.white); jMenu2.setText("系统"); jMenuItem5.setText("关于"); jMenuItem5.addActionListener(new MainFrame_jMenuItem5_actionAdapter(this)); jMenuItem9.setText("冻结帐户"); jMenuItem9.addActionListener(new MainFrame_jMenuItem9_actionAdapter(this)); jMenuItem10.setEnabled(false); jMenuItem10.setText("转 账"); jMenuItem11.setText("清单查询"); jMenuItem11.addActionListener(new MainFrame_jMenuItem11_actionAdapter(this)); jMenuItem7.setEnabled(false); jMenuItem7.setText("帐户除名"); jMenuItem12.setText("帐户信息"); jMenuItem12.addActionListener(new MainFrame_jMenuItem12_actionAdapter(this)); jMenuItem13.setText("解冻帐户"); jMenuItem13.addActionListener(new MainFrame_jMenuItem13_actionAdapter(this)); jLabel3.setText("jLabel3"); jLabel3.setBounds(new Rectangle(0, 0, 602, 450)); jMenuBar1.add(jMenu1); jMenuBar1.add(jMenu3); jMenuBar1.add(jMenu2); jMenu1.add(jMenuItem1); jMenu1.add(jMenuItem2); jMenu1.add(jMenuItem10); jMenu1.addSeparator(); jMenu1.add(jMenuItem11); jMenu1.add(jMenuItem3); jMenu1.addSeparator(); jMenu1.add(jMenuItem4); jMenu1.addSeparator(); jMenu1.add(jMenuItem6); contentPane.add(jLabel2, null); contentPane.add(jLabel1, null); contentPane.add(jLabel3, null); jMenu3.add(jMenuItem8); jMenu3.addSeparator(); jMenu3.add(jMenuItem9); jMenu3.add(jMenuItem13); jMenu3.addSeparator(); jMenu3.add(jMenuItem7); jMenu3.addSeparator(); jMenu3.add(jMenuItem12); jMenu2.add(jMenuItem5); jMenuBar1.setBackground(Color.blue); this.setJMenuBar(jMenuBar1); this.setResizable(false); /** * 居中界面 */ } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } void jMenuItem1_actionPerformed(ActionEvent e) { FetchPanel fetchPanel = new FetchPanel(this); this.remove(this.getContentPane()); this.setContentPane(fetchPanel); this.setResizable(false); this.show(); } void jMenuItem2_actionPerformed(ActionEvent e) { if (n == 3) { JOptionPane.showMessageDialog(this, "系统将关闭,若有问题请与管理员联系\n QQ:306905603", "错误", 1); System.exit(0); } //调出管理员信息,正确时调出增加用户对话框 JPasswordField pwd = new JPasswordField(); Object[] message = { "请输入管理员密码:", pwd}; int res = JOptionPane.showConfirmDialog(this, message, "", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); String passWord = pwd.getText(); if (res == JOptionPane.CANCEL_OPTION) { return; } Database bean = new Database(); try { bean.OpenConn(); } catch (Exception ex) { System.out.println("ex:at login admin"); } /** * 构建查询管理员的密码的SQL语句 */ String sql = "select * from admin where admin.passWord='" + passWord + "'"; ResultSet rs = bean.executeQuery(sql); try { if (rs.next()) { n = 0; SavePanel savePanel = new SavePanel(this); this.remove(this.getContentPane()); this.setContentPane(savePanel); this.setResizable(false); this.show(); } else { n++; JOptionPane.showMessageDialog(this, "登录系统失败,管理员密码有误!", "错误", 1); return; } } catch (Exception ex) { System.out.println("ex:admin select Exceptiion"); } bean.closeStmt(); bean.closeConn(); } void jMenuItem3_actionPerformed(ActionEvent e) { MsgPanel msg = new MsgPanel(" 您好,您的帐号为: " + LoginFrame.ID + "\n 您的密码为: " + LoginFrame.passWord + "\n 当前帐户余额为: " + LoginFrame.money); this.remove(this.getContentPane()); this.setContentPane(msg); this.setResizable(false); this.show(); } void jMenuItem4_actionPerformed(ActionEvent e) { ConPassPanel conPassPanel = new ConPassPanel(this); this.remove(this.getContentPane()); this.setContentPane(conPassPanel); this.setResizable(false); this.show(); } void jMenuItem6_actionPerformed(ActionEvent e) { int value = JOptionPane.showConfirmDialog(this, "你确定要退出吗?", "系统提示", 0, 3); if (value == 0) { JOptionPane.s
评论
    相关推荐
    • Java
      Java
    • java
      Java
    • Java
      Java
    • Java
      Java项目
    • Java
      Java 对于Java练习
    • java
      Java 此回购包括我学习Java的旅程。
    • java
      Java Java基础
    • Java
      Java
    • Java
      Java 我创建的Java项目
    • Java
      Java 2021/02/19 .java Main.java 学生.java Bmi.java 。班级 Bmi类 主类 MyBmi.class 学生班 学生样本类 2021/02/20 .java DeleteFile.java WriteFile.java MyDataPrint.java 。班级 DeleteFile.class ...