[求助]ATM机程序问题
最近我在编个ATM机GUI程序,用swing做,可是现在遇到4个错误了,应该都是结构体上的问题,但我一直不知道怎么解决。我的主程序AtmGUI程序如下,
现在总是提示红色字的地方有问题,“cannot resolve symbol : constructor KeyPad
(AtmGUI)”和“cannot resolve symbol : constructor KeyPad (AtmGUI)”
万能的版住能不能指点一下?苦恼死了
import javax.swing.*; //Packages used
import java.awt.*;
import java.awt.event.*;
public class AtmGUI extends JFrame
implements ActionListener{
private JButton confirm = new JButton("Confirm");
private JTextField input = new JTextField(20);
private JTextArea display = new JTextArea(5,20);
private KeyPad keypad = new KeyPad(this); //“cannot resolve symbol : constructor KeyPad
(AtmGUI)
private FounctionPad founctionpad = new FounctionPad(this); //cannot resolve symbol : constructor KeyPad (AtmGUI)
public AtmGUI(){
getContentPane().setLayout(new BorderLayout());
keypad = new KeyPad(this);
founctionpad = new FounctionPad(this);
getContentPane().add(input,"North"); //input
getContentPane().add(display,"Center"); //display
display.setLineWrap(true);
display.setEditable(false);
JPanel controlPanel = new JPanel(new BorderLayout(0,0)); //control panel
controlPanel.add(keypad,"Center");
controlPanel.add(confirm,"South");
getContentPane().add(controlPanel,"East");
getContentPane().add(founctionpad,"West"); //founction
confirm.addActionListener(this);
input.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
double cash = Double.valueOf(input.getText()).doubleValue();
display.append(cash+"\n");
input.setText("");
}
public void keypressCallback(String s){
if(s.equals("C"))
input.setText("");
else
input.setText(input.getText() + s);
}
public static void main(String args[]){
AtmGUI f = new AtmGUI();
f.setSize(400,300);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
[此贴子已经被作者于2006-6-4 15:50:11编辑过]
----------------解决方案--------------------------------------------------------
KeyPad类你没有提供参数为AtmGUI的构造函数吧
----------------解决方案--------------------------------------------------------
谢谢!我还是新手
----------------解决方案--------------------------------------------------------
希望把改后的程序尽快的发上来,或者斑竹帮忙改后的发上来,拜托
----------------解决方案--------------------------------------------------------
KeyPad你这个类应该没的带参的构造函数。
----------------解决方案--------------------------------------------------------