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

📄 chamfer.java

📁 网上银行 登录
💻 JAVA
字号:
package bank;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

import bank.dao.CheckChamfer;
import bank.dao.CheckLogin;

public class Chamfer implements ActionListener {

	/**
	 * @param args
	 */

	public static JFrame f;

	JPanel p1, p2;

	JButton b1, b2, b3, b4, b5, b6;

	public Chamfer() {
		f = new JFrame();
		p1 = new JPanel();
		p2 = new JPanel();
		b1 = new JButton("100");
		b2 = new JButton("200");
		b3 = new JButton("500");
		b4 = new JButton("1000");
		b5 = new JButton("2000");
		b6 = new JButton("返回");

		b1.addActionListener(this);
		b2.addActionListener(this);
		b3.addActionListener(this);
		b4.addActionListener(this);
		b5.addActionListener(this);
		b6.addActionListener(this);

		f.setTitle("中国工商新一代网上银行");
		f.setLayout(null);
		f.setVisible(true);
		f.setBounds(300, 200, 400, 300);
		f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}

	public void setlayout() {
		JPanel p = new JPanel();
		// p1.setBorder(new TitledBorder("存款信息"));
		p1.setLayout(new GridLayout(3, 1, 40, 20));
		p1.setBounds(20, 40, 80, 180);

		// p2.setBorder(new TitledBorder("存款信息"));
		p2.setLayout(new GridLayout(3, 1, 40, 20));
		p2.setBounds(250, 40, 80, 180);

		p1.add(b1);
		p1.add(b2);
		p1.add(b3);
		p2.add(b4);
		p2.add(b5);
		p2.add(b6);

		p.setBounds(20, 20, 360, 230);
		p.setBorder(new TitledBorder("选择取款金额"));
		p.setLayout(null);
		p.add(p1);
		p.add(p2);

		f.add(p);
	}

	public static void main(String[] args) {
		// TODO 自动生成方法存根
		Chamfer cha = new Chamfer();
		cha.setlayout();
	}

	public void actionPerformed(ActionEvent arg0) {
		// TODO 自动生成方法存根
		JButton b = (JButton)arg0.getSource();
		CheckChamfer chec = new CheckChamfer();
		if (b == b1) {
			System.out.println(b1.getText());
			if(chec.isChamfer(b1.getText()))
			{
				chec.alterMonery(b1.getText());
				System.out.println(new Double(CheckLogin.presentUser.getMonery()).toString());
				JOptionPane.showMessageDialog(Chamfer.f, "取款成功", "信息提示!",
						JOptionPane.INFORMATION_MESSAGE);
				f.dispose();
				Fuction fuction = new Fuction();
				fuction.setlayout();
			}
		} else if (b == b2) {
			if(chec.isChamfer(b2.getText()))
			{
				chec.alterMonery(b2.getText());
				System.out.println(new Double(CheckLogin.presentUser.getMonery()).toString());
				JOptionPane.showMessageDialog(Chamfer.f, "取款成功", "信息提示!",
						JOptionPane.INFORMATION_MESSAGE);
				f.dispose();
				Fuction fuction = new Fuction();
				fuction.setlayout();
			}
		} else if (b == b3) {
			if(chec.isChamfer(b3.getText()))
			{
				chec.alterMonery(b3.getText());
				System.out.println(new Double(CheckLogin.presentUser.getMonery()).toString());
				JOptionPane.showMessageDialog(Chamfer.f, "取款成功", "信息提示!",
						JOptionPane.INFORMATION_MESSAGE);
				f.dispose();
				Fuction fuction = new Fuction();
				fuction.setlayout();
			}
		} else if (b == b4) {
			if(chec.isChamfer(b4.getText()))
			{
				chec.alterMonery(b4.getText());
				System.out.println(new Double(CheckLogin.presentUser.getMonery()).toString());
				JOptionPane.showMessageDialog(Chamfer.f, "取款成功", "信息提示!",
						JOptionPane.INFORMATION_MESSAGE);
				f.dispose();
				Fuction fuction = new Fuction();
				fuction.setlayout();
			}
		} else if (b == b5) {
			if(chec.isChamfer(b5.getText()))
			{
				chec.alterMonery(b5.getText());
				System.out.println(new Double(CheckLogin.presentUser.getMonery()).toString());
				JOptionPane.showMessageDialog(Chamfer.f, "取款成功", "信息提示!",
						JOptionPane.INFORMATION_MESSAGE);
				f.dispose();
				Fuction fuction = new Fuction();
				fuction.setlayout();
			}
		} else {
			f.dispose();
			Fuction fuction = new Fuction();
			fuction.setlayout();
		}
	}

}

⌨️ 快捷键说明

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