一個extends JFrame 且implements ActionListener的類,,在其中的JButton上加一個監聽。
在構造方法中這樣寫 會報錯
button.addActionListener(this{
public void actionPerformed(ActionEvent e){
.....
}
}
為什麽?謝謝。。
在構造方法中這樣寫 會報錯
button.addActionListener(this{
public void actionPerformed(ActionEvent e){
.....
}
}
為什麽?謝謝。。
这个时候this也只是你继承的JFrame的类。