⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zhuanzhanframe.java~106~

📁 JAVA版ATM会员机模拟程序设计
💻 JAVA~106~
字号:
package com.zhou.view;

import java.awt.*;
import com.zhou.model.*;
import com.zhou.control.*;
import java.util.Calendar;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ZhuanZhanFrame extends JFrame {
    Card card = new Card();

    public ZhuanZhanFrame(Card card) {
        this.card = card;
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(null);
        setSize(new Dimension(800, 600));
        setTitle("转账");
        jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 30));
        jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel1.setText("转   账");
        jLabel1.setBounds(new Rectangle(300, 18, 200, 35));
        jButton1.addActionListener(new ZhuanZhanFrame_jButton1_actionAdapter(this));
        jButton2.addActionListener(new ZhuanZhanFrame_jButton2_actionAdapter(this));
        jButton3.addActionListener(new ZhuanZhanFrame_jButton3_actionAdapter(this));
        jButton3.setBounds(new Rectangle(551, 440, 110, 40));
        jButton3.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jButton3.setText("返 回");
        jButton2.setBounds(new Rectangle(370, 440, 110, 40));
        jButton2.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jButton2.setText("重 置");
        jButton1.setBounds(new Rectangle(198, 440, 110, 40));
        jButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jButton1.setText("确 认");
        jTextField2.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jTextField2.setHorizontalAlignment(SwingConstants.CENTER);
        jTextField2.setBounds(new Rectangle(325, 229, 320, 30));
        jTextField1.setFont(new java.awt.Font("宋体", Font.PLAIN, 25));
        jTextField1.setHorizontalAlignment(SwingConstants.CENTER);
        jTextField1.setBounds(new Rectangle(325, 135, 320, 30));
        jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel3.setText("转入金额:");
        jLabel3.setBounds(new Rectangle(160, 229, 160, 30));
        jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jLabel2.setText("请输入对方帐号:");
        jLabel2.setBounds(new Rectangle(160, 135, 160, 30));
        jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 35));
        jLabel4.setForeground(Color.red);
        jLabel4.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel4.setBounds(new Rectangle( -1, 314, 800, 64));
        this.getContentPane().add(jLabel1);
        this.getContentPane().add(jTextField1);
        this.getContentPane().add(jLabel3);
        this.getContentPane().add(jTextField2);
        this.getContentPane().add(jLabel4);
        this.getContentPane().add(jLabel2);
        this.getContentPane().add(jButton3);
        this.getContentPane().add(jButton1);
        this.getContentPane().add(jButton2);

    }

    ConnectionDB db = new ConnectionDB(card);
    Trans trans = new Trans();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JTextField jTextField2 = new JTextField();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JButton jButton3 = new JButton();
    JLabel jLabel4 = new JLabel();

    public void jButton1_actionPerformed(ActionEvent e) {
        jLabel4.setText("");
        String id = jTextField1.getText();

        //float money = Float.parseFloat(jTextField2.getText());
        String str = DengLuFrame.txtname;

        if (id.equals("")) {
            jLabel4.setText("请输入卡号!!");
            return;
        }
        float money=0.0;
        try {
             money = Float.parseFloat(jTextField2.getText());

        } catch (Exception ex) {

        }
        if (money <= 0) {
            jLabel4.setText("请输入正确金额!!");
            return;
        }
        if (id.equals(str)) {
            jLabel4.setText("你输入的卡号相同,请重新输入!!");
            return;
        }

        NewDate newdate = new NewDate();
        String date = newdate.getDate();
        String sql = "select * from card where userID='" + id + "'";
        String sql1 = "select *from card where userID='" + card.getUserID() +
                      "'";
        String sql2 = "update card set balance=balance-'" + money +
                      "' where userID='" + card.getUserID() + "'";
        String sql3 = "update card set balance=balance+'" + money +
                      "' where userID='" + id + "'";

    }

    public void jButton2_actionPerformed(ActionEvent e) {
        jTextField1.setText("");
        jTextField2.setText("");
    }

    public void jButton3_actionPerformed(ActionEvent e) {
        Open open = new Open(card);
        this.dispose();
    }
}


class ZhuanZhanFrame_jButton3_actionAdapter implements ActionListener {
    private ZhuanZhanFrame adaptee;
    ZhuanZhanFrame_jButton3_actionAdapter(ZhuanZhanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton3_actionPerformed(e);
    }
}


class ZhuanZhanFrame_jButton2_actionAdapter implements ActionListener {
    private ZhuanZhanFrame adaptee;
    ZhuanZhanFrame_jButton2_actionAdapter(ZhuanZhanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton2_actionPerformed(e);
    }
}


class ZhuanZhanFrame_jButton1_actionAdapter implements ActionListener {
    private ZhuanZhanFrame adaptee;
    ZhuanZhanFrame_jButton1_actionAdapter(ZhuanZhanFrame adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -