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

📄 trad.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.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

import bank.dao.CheckTrad;

public class Trad implements ActionListener {

	/**
	 * @param args
	 */
	public static JFrame f;

	JPanel p1, p2;

	JLabel l1, l2, l3, l4, l5, l6;

	JTextField t1, t4, t5, t6;

	JPasswordField t2, t3;

	JButton b1, b2;

	public Trad() {
		p1 = new JPanel();
		p2 = new JPanel();
		b1 = new JButton("确定");
		b2 = new JButton("返回");

		l1 = new JLabel("用户账号", JLabel.CENTER);// 由16或19位数字组成的账号
		l2 = new JLabel("密码", JLabel.CENTER);// 小于16位的数字和字母组成
		l3 = new JLabel("确定密码", JLabel.CENTER);
		t1 = new JTextField();
		t2 = new JPasswordField();
		t3 = new JPasswordField();

		l4 = new JLabel("用户名", JLabel.CENTER);
		l5 = new JLabel("证件号码", JLabel.CENTER);
		l6 = new JLabel("电话号码", JLabel.CENTER);
		t4 = new JTextField();
		t5 = new JTextField();
		t6 = new JTextField();

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

	public void setlayout() {
		p1.setLayout(new GridLayout(3, 2, 40, 10));
		p1.setBorder(new TitledBorder("注册新用户"));
		p1.setBounds(30, 20, 330, 140);
		p1.add(l1);
		p1.add(t1);
		p1.add(l2);
		p1.add(t2);
		p1.add(l3);
		p1.add(t3);

		p2.setLayout(new GridLayout(3, 2, 40, 10));
		p2.setBorder(new TitledBorder("用户基本信息"));
		p2.setBounds(30, 170, 330, 140);
		p2.add(l4);
		p2.add(t4);
		p2.add(l5);
		p2.add(t5);
		p2.add(l6);
		p2.add(t6);

		b1.setBounds(80, 320, 80, 40);
		b2.setBounds(200, 320, 80, 40);
		f.add(p1);
		f.add(p2);
		f.add(b1);
		f.add(b2);

		b1.addActionListener(this);
		b2.addActionListener(this);
	}

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

	public void actionPerformed(ActionEvent arg0) {
		// TODO 自动生成方法存根
		if (b1 == arg0.getSource()) {
			CheckTrad check = new CheckTrad();
			if(check.isTrad(t1.getText(),t2.getText(),t3.getText(),t4.getText(),t5.getText(),t6.getText()))
			{
				JOptionPane.showMessageDialog(Trad.f, "注册成功", "信息提示!", JOptionPane.INFORMATION_MESSAGE);
				f.dispose();
				Login login = new Login();
				login.setlayout();	
			}
		}
		if (b2 == arg0.getSource()) {
			f.dispose();
			Login login = new Login();
			login.setlayout();	
		}
	}

}

⌨️ 快捷键说明

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