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

📄 zhujiemian.java~34~

📁 一個模仿ATM自動提款机功能的系統,
💻 JAVA~34~
字号:
package MainFrame;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.Color;
import javax.swing.JPasswordField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import DataBaseManager.DataBaseManager;
import java.sql.ResultSet;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.awt.SystemColor;

public class ZhuJieMian extends JFrame {
    XYLayout xYLayout1 = new XYLayout();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    JPasswordField jPasswordField1 = new JPasswordField();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JButton jButton3 = new JButton();
    JButton jButton4 = new JButton();
    public ZhuJieMian() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
    private void jbInit() throws Exception {
        getContentPane().setLayout(xYLayout1);
        jLabel1.setFont(new java.awt.Font("华文彩云", Font.BOLD, 25));
        jLabel1.setForeground(Color.green);
        jLabel1.setText("操作主界面");
        jLabel3.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
        jLabel3.setForeground(Color.red);
        jLabel3.setText("请再次输入密码");
        jLabel2.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
        jLabel2.setForeground(Color.red);
        jLabel2.setText("为了您的操作成功");
        this.addWindowListener(new ZhuJieMian_this_windowAdapter(this));
        jButton1.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
        jButton1.setText("查詢餘額");
        jButton1.addActionListener(new ZhuJieMian_jButton1_actionAdapter(this));
        xYLayout1.setWidth(402);
        xYLayout1.setHeight(354);
        jButton3.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
        jButton3.setText("轉帳");
        jButton3.addActionListener(new ZhuJieMian_jButton3_actionAdapter(this));
        jButton4.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
        jButton4.setText("取消");
        jButton4.addActionListener(new ZhuJieMian_jButton4_actionAdapter(this));
        jButton2.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
        jButton2.setText("取款");
        jButton2.addActionListener(new ZhuJieMian_jButton2_actionAdapter(this));
        this.setForeground(SystemColor.activeCaptionBorder);
        this.getContentPane().add(jLabel2, new XYConstraints(76, 83, 170, 39));
        this.getContentPane().add(jLabel3, new XYConstraints(76, 131, 152, 32));
        this.getContentPane().add(jPasswordField1,
                                  new XYConstraints(74, 199, 143, 37));
        this.getContentPane().add(jButton1, new XYConstraints(290, 80, 100, 50));
        this.getContentPane().add(jButton3, new XYConstraints(290, 200, 100, 50));
        this.getContentPane().add(jButton2, new XYConstraints(290, 140, 100, 50));
        this.getContentPane().add(jButton4, new XYConstraints(290, 260, 100, 50));
        this.getContentPane().add(jLabel1, new XYConstraints(142, 10, 171, 44));
    }
    public static void main(String[] args) {
        ZhuJieMian z = new ZhuJieMian();
        z.setBounds(200,200,400,400);
        z.setVisible(true);
    }

    public void jButton1_actionPerformed(ActionEvent e) {
         try { char a[]=jPasswordField1.getPassword();
               String c=new String(a);
             if(a.length==0){
                 JOptionPane.showMessageDialog(null,"沒有輸入密码!","輸入錯誤",JOptionPane.ERROR_MESSAGE);
             }
             else {ResultSet rs;
                  DataBaseManager dbm=new DataBaseManager();
                  dbm.connect();
                  String sql="select * from YH where userpassword='"+ c+"'";
                  rs=dbm.getResult(sql);
             if(rs.next()){
                  //this.dispose();
                   String d=rs.getString(3);
                   String d1=rs.getString(4);
                   JOptionPane.showMessageDialog(null,d+"先生   您还剩下  "+d1+"元","查詢信息",JOptionPane.ERROR_MESSAGE);}
                       jPasswordField1.setText("");
             }
         } catch (Exception ex) {

         }
    }

    public void this_windowClosing(WindowEvent e) {
         System.exit(0);
    }

    public void jButton4_actionPerformed(ActionEvent e) {
        HuanYing h = new HuanYing();
        h.setBounds(200,200,400,400);
        h.setVisible(true);
    }

    public void jButton2_actionPerformed(ActionEvent e) {
        QuKuan q = new QuKuan();
        q.setBounds(200,200,400,400);
        q.setVisible(true);
    }

    public void jButton3_actionPerformed(ActionEvent e) {
        this.dispose();
        ZhuanZhang z = new ZhuanZhang();
        z.setBounds(200,200,400,400);
        z.setVisible(true);

    }
}


class ZhuJieMian_jButton3_actionAdapter implements ActionListener {
    private ZhuJieMian adaptee;
    ZhuJieMian_jButton3_actionAdapter(ZhuJieMian adaptee) {
        this.adaptee = adaptee;
    }

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


class ZhuJieMian_jButton2_actionAdapter implements ActionListener {
    private ZhuJieMian adaptee;
    ZhuJieMian_jButton2_actionAdapter(ZhuJieMian adaptee) {
        this.adaptee = adaptee;
    }

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


class ZhuJieMian_jButton4_actionAdapter implements ActionListener {
    private ZhuJieMian adaptee;
    ZhuJieMian_jButton4_actionAdapter(ZhuJieMian adaptee) {
        this.adaptee = adaptee;
    }

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


class ZhuJieMian_jButton1_actionAdapter implements ActionListener {
    private ZhuJieMian adaptee;
    ZhuJieMian_jButton1_actionAdapter(ZhuJieMian adaptee) {
        this.adaptee = adaptee;
    }

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


class ZhuJieMian_this_windowAdapter extends WindowAdapter {
    private ZhuJieMian adaptee;
    ZhuJieMian_this_windowAdapter(ZhuJieMian adaptee) {
        this.adaptee = adaptee;
    }

    public void windowClosing(WindowEvent e) {
        adaptee.this_windowClosing(e);
    }
}

⌨️ 快捷键说明

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