atmjm.java
来自「模拟ATM取款机,没有连接数据库!自己设的密码和账号!功能基本实现!」· Java 代码 · 共 111 行
JAVA
111 行
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*public class QK
{
private JFrame jframe;
private JPanel jpl;
public QK()
{
//jframe=new JFrame("欢迎使用ATM");
Container c=jframe.getContentPane();
jpl=new Jpanel();
c.add(jpl);
jframe.setSize(350,300);
jframe.setLocation(300,250);
jframe.setVisible(true);
jframe.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);}
});
}
}*/
class ATMJM extends JFrame
{
JButton j1,j2,j3,j4;
private JFrame jframe;
int cache;
String pass;
public ATMJM(int cache, String pass)
{
this.pass = pass;
this.cache = cache;
init();
}
public void init() {
Container c=getContentPane();
//jpl=new Jpanel();
//c.add(jpl);
setSize(500,500);
setLocation(300,250);
setVisible(true);
/* addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);}
});*/
c.setLayout(new FlowLayout());
j1=new JButton("取出现金");
j1.setForeground(Color.black);
j1.setBackground(Color.WHITE);
j1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent Event)
{
setVisible(false);
QK a=new QK(cache, pass);
a.setVisible(true);
}
});
j2=new JButton("查询余额");
j2.setForeground(Color.black);
j2.setBackground(Color.WHITE);
j2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ATMCX atmcx = new ATMCX(cache, pass);
setVisible(false);
atmcx.setVisible(true);
}
});
j3=new JButton("修改密码");
j3.setForeground(Color.black);
j3.setBackground(Color.WHITE);
j3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ATMXG atmxg = new ATMXG(cache, pass);
setVisible(false);
atmxg.setVisible(true);
}
});
j4=new JButton("退出系统");
j4.setForeground(Color.black);
j4.setBackground(Color.WHITE);
j4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent Event)
{
setVisible(false);
}
});
c.add (j1);
c.add (j2);
c.add (j3);
c.add (j4);
}
public static void main(String[] args)
{
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?