我做了一个JAVA关于ATM机的程序,程序显示没有编译错误,但是运行起来走到一半就不继续了,求高人帮忙改
importjavax.swing.*;importjava.awt.*;importjavax.swing.border.*;importjava.awt.event....
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.io.*;
/*登陆页面首窗口*/
public class WindowBox extends Frame implements ActionListener{
Box baseBox,box1,box2;
TextField tf1,tf2;
Button button1;
Button button2;
WindowBox(String s){//构造方法
super(s);
tf1 = new TextField(16);
tf2 = new TextField(16);
box1= Box.createVerticalBox();
box1.add(new Label("请输入你的卡号")); //输入卡号
box1.add(Box.createVerticalStrut(8));
box1.add(new Label("请输入你的密码"));//输入密码
box2=Box.createVerticalBox();
box2.add(Box.createVerticalStrut(8));
box2.add(tf2);
box2.add(new TextField(16));
baseBox=Box.createHorizontalBox();
baseBox.add(box1);
baseBox.add(Box.createHorizontalStrut(10));
baseBox.add(box2);
add(baseBox);
button1= new Button("确定");//加入按钮
button1.addActionListener(this);
add(button1);
button2 = new Button("退卡");//退卡按钮
button2.addActionListener(this);
add(button2);
setLayout(new FlowLayout());/*监听器*/
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}});
setBounds(400,200,400,200);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
Account act;
String card;
String pwd;
act=new Account("123456","水洁","123456",10000);//初始化
/*选择各种服务*/
if(e.getSource() == button1){
String number1,number2;//输入的两个卡号和密码的变量
number1=tf1.getText();
number2=tf2.getText();/*判断两次输入的卡号和密码是否正确*/
((act.get_Code().equals(number1))&&(act.get_Password().equals(number2))){
dispose();
Selection s = new Selection("选择服务",act);
else{
dispose();
ErrorWarn ew = new ErrorWarn();//报输入密码或卡号不正确}
} if(e.getSource()==button2){
System.exit(0);import
代码比较长,分好几个小节,这里地方太小我只贴了两节(一共7节)。望高手解答,小女子感激不尽,我QQ644831003。要看代码的Q我,谢谢。我的总分就20.全部拿去 展开
import java.awt.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.io.*;
/*登陆页面首窗口*/
public class WindowBox extends Frame implements ActionListener{
Box baseBox,box1,box2;
TextField tf1,tf2;
Button button1;
Button button2;
WindowBox(String s){//构造方法
super(s);
tf1 = new TextField(16);
tf2 = new TextField(16);
box1= Box.createVerticalBox();
box1.add(new Label("请输入你的卡号")); //输入卡号
box1.add(Box.createVerticalStrut(8));
box1.add(new Label("请输入你的密码"));//输入密码
box2=Box.createVerticalBox();
box2.add(Box.createVerticalStrut(8));
box2.add(tf2);
box2.add(new TextField(16));
baseBox=Box.createHorizontalBox();
baseBox.add(box1);
baseBox.add(Box.createHorizontalStrut(10));
baseBox.add(box2);
add(baseBox);
button1= new Button("确定");//加入按钮
button1.addActionListener(this);
add(button1);
button2 = new Button("退卡");//退卡按钮
button2.addActionListener(this);
add(button2);
setLayout(new FlowLayout());/*监听器*/
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}});
setBounds(400,200,400,200);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
Account act;
String card;
String pwd;
act=new Account("123456","水洁","123456",10000);//初始化
/*选择各种服务*/
if(e.getSource() == button1){
String number1,number2;//输入的两个卡号和密码的变量
number1=tf1.getText();
number2=tf2.getText();/*判断两次输入的卡号和密码是否正确*/
((act.get_Code().equals(number1))&&(act.get_Password().equals(number2))){
dispose();
Selection s = new Selection("选择服务",act);
else{
dispose();
ErrorWarn ew = new ErrorWarn();//报输入密码或卡号不正确}
} if(e.getSource()==button2){
System.exit(0);import
代码比较长,分好几个小节,这里地方太小我只贴了两节(一共7节)。望高手解答,小女子感激不尽,我QQ644831003。要看代码的Q我,谢谢。我的总分就20.全部拿去 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询