📄 bankmodel_01.java
字号:
package bank;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.JFrame;
public class BankModel_01 extends JFrame implements ActionListener
{
/*
* 登陆界面
*/
/**
*
*/
private static final long serialVersionUID = -8752670295056598267L;
static String randomStr = "";
static Button b1,b2;
static TextField t1,t2,t3;
static BankModel_01 bm;
public void addc()
{
bm = new BankModel_01();
Label l1 = new Label("欢迎使用中国建设银行ATM机取款系统");
l1.setFont(new Font("",2,20));
Label l2 = new Label("*用 户 登 录 界 面*");
Label l3 = new Label("账 号:");
Label l4 = new Label("密 码:");
Label l5 = new Label("验证码:");
Label l6 = new Label("请输入下面的数字");
Label l7 = new Label();
Label l8 = new Label("-----------------------------------------------------");
Random ran = new Random();
for(int i=1;i<=4;i++)
randomStr += ran.nextInt(9);
l7.setText(randomStr);
l6.setFont(new Font("",4,11));
b1 = new Button("登 录");
b2 = new Button("注 册");
t1 = new TextField();
t2 = new TextField();
t3 = new TextField();
b1.setBounds(180,350,80,30);
b2.setBounds(360,165,80,30);
l1.setBounds(20,20,400,25);
l2.setBounds(20,100,400,20);
l3.setBounds(100,170,80,20);
l4.setBounds(100,220,80,20);
l5.setBounds(100,270,80,20);
l6.setBounds(180,290,100,20);
l7.setBounds(180,310,40,30);
l7.setBackground(Color.gray);
l7.setForeground(Color.blue);
l8.setBounds(20,120,400,20);
t1.setBounds(180,170,160,20);
t2.setBounds(180,220,160,20);
t3.setBounds(180,270,160,20);
bm.add(l1);
bm.add(l2);
bm.add(l3);
bm.add(l4);
bm.add(l5);
bm.add(l6);
bm.add(l7);
bm.add(l8);
bm.add(t1);
bm.add(t2);
bm.add(t3);
bm.add(b1);
bm.add(b2);
b1.addActionListener(bm);
bm.setLayout(null);
bm.setTitle("ATM机取款系统");
bm.setBounds(300,200,500,450);
bm.setVisible(true);
bm.setResizable(false);
bm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
public static void main(String[] args)
{
BankModel_01 bm_01 = new BankModel_01();
bm_01.addc();
}
public void actionPerformed(ActionEvent arg0) {
// TODO 自动生成方法存根
}
// public void actionPerformed(ActionEvent arg0)
// {
// if(t3.getText().equals(randomStr))
// {
// BankModel_02 bm_02 = new BankModel_02();
// bm_02.addc();
// BankModel_01.bm.dispose();
// }
//
// }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -