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

📄 menu.java

📁 这个系统的功能是模拟ATM机的登陆、查询余额、取款、更改密码等功能
💻 JAVA
字号:

/*****************************************
 * <p>Title: ATM自动取款机</p>
 *
 * <p>Description: 模拟</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author vinky_sc
 * @version 1.0
 *****************************************/


import javax.swing.JFrame;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.Color;
import javax.swing.UIManager;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/*****************************************
 * 菜单窗口(功能窗口)
 *
 * 主要是执行各种不同的功能,包括:查询余额、取款、修改密码等。
 *****************************************/
 
public class menu extends JFrame {
    XYLayout xYLayout1 = new XYLayout();
    JLabel jLabel1 = new JLabel();
    JButton jButton1 = new JButton();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    JLabel jLabel4 = new JLabel();
    JLabel jLabel5 = new JLabel();
    JLabel jLabel6 = new JLabel();
    JLabel jLabel7 = new JLabel();
    JLabel jLabel8 = new JLabel();
    JButton jButton2 = new JButton();
    JButton jButton3 = new JButton();
    JButton jButton4 = new JButton();
    public menu() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(xYLayout1);
        jLabel1.setBackground(UIManager.getColor("ComboBox.selectionBackground"));
        jLabel1.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
        this.getContentPane().setBackground(Color.lightGray);
        this.setResizable(false);
        setSize(new Dimension(400, 330));
        setTitle("模拟ATM自动取款机--菜单");
        jLabel1.setToolTipText("");
        jLabel1.setText("欢迎使用ATM自动取款机");
        jButton1.setText("查  询");
        jButton1.addActionListener(new menu_jButton1_actionAdapter(this));
        jLabel2.setText(" 请你选择右边的业务服务");
        jLabel3.setText(" 业务介绍:");
        jLabel4.setText("     大体分为查询、取款、修改");
        jLabel5.setText(" 密码等功能。");
        xYLayout1.setWidth(400);
        xYLayout1.setHeight(330);
        jLabel6.setText(" 查询:主要是查询帐户余额。");
        jLabel7.setText(" 取款:每次取款金额不能超过2000元。");
        jLabel8.setText(" 修改密码:密码重设,一定要牢记!");
        jButton2.setText("取  款");
        jButton2.addActionListener(new menu_jButton2_actionAdapter(this));
        jButton3.setText("修改密码");
        jButton3.addActionListener(new menu_jButton3_actionAdapter(this));
        jButton4.setText("返  回");
        jButton4.addActionListener(new menu_jButton4_actionAdapter(this));
        this.getContentPane().add(jLabel1, new XYConstraints(108, 21, 185, 35));
        this.getContentPane().add(jLabel2, new XYConstraints(47, 60, 150, 30));
        this.getContentPane().add(jLabel3, new XYConstraints(47, 91, 90, 30));
        this.getContentPane().add(jLabel4, new XYConstraints(47, 120, 184, 30));
        this.getContentPane().add(jLabel5, new XYConstraints(47, 140, 149, 30));
        this.getContentPane().add(jLabel6, new XYConstraints(47, 169, 184, 30));
        this.getContentPane().add(jLabel7, new XYConstraints(47, 198, 213, 30));
        this.getContentPane().add(jLabel8, new XYConstraints(47, 227, 213, 30));
        this.getContentPane().add(jButton1, new XYConstraints(262, 75, 94, 30));
        this.getContentPane().add(jButton2, new XYConstraints(262, 128, 94, 30));
        this.getContentPane().add(jButton3, new XYConstraints(262, 179, 94, 30));
        this.getContentPane().add(jButton4, new XYConstraints(262, 233, 94, 30));
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = this.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        this.setLocation((screenSize.width - frameSize.width) / 2,
                          (screenSize.height - frameSize.height) / 2);
        this.setVisible(true);
    }

//用按钮进入相应的窗口,并关闭当前窗口
    public void jButton1_actionPerformed(ActionEvent e) {
        new DemandBalance().setVisible(true);
        this.dispose();
    }

    public void jButton2_actionPerformed(ActionEvent e) {
        new distill().setVisible(true);
        this.dispose();
    }

    public void jButton3_actionPerformed(ActionEvent e) {
        new AmendPassword().setVisible(true);
        this.dispose();
    }

    public void jButton4_actionPerformed(ActionEvent e) {
        new ATM();
        this.dispose();
    }
}


class menu_jButton4_actionAdapter implements ActionListener {
    private menu adaptee;
    menu_jButton4_actionAdapter(menu adaptee) {
        this.adaptee = adaptee;
    }

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


class menu_jButton1_actionAdapter implements ActionListener {
    private menu adaptee;
    menu_jButton1_actionAdapter(menu adaptee) {
        this.adaptee = adaptee;
    }

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


class menu_jButton2_actionAdapter implements ActionListener {
    private menu adaptee;
    menu_jButton2_actionAdapter(menu adaptee) {
        this.adaptee = adaptee;
    }

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


class menu_jButton3_actionAdapter implements ActionListener {
    private menu adaptee;
    menu_jButton3_actionAdapter(menu adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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