java问题, public void actionPerformed(ActionEvent event)这句有错吗?
不知道哪里错了?packageg1;importjavax.swing.*;importjava.awt.event.*;publicclasspiimplementsA...
不知道哪里错了?
package g1;
import javax.swing.*;
import java.awt.event.*;
public class pi implements ActionListener {
JButton B1=new JButton();
public static void main(String args[]){
pi p1=new pi();
p1.go();
}
public void go(){
JFrame frame=new JFrame();
B1.addActionListener(this);
public void actionPerformed(ActionEvent event){
B1.setText("abc");
}
}
} 展开
package g1;
import javax.swing.*;
import java.awt.event.*;
public class pi implements ActionListener {
JButton B1=new JButton();
public static void main(String args[]){
pi p1=new pi();
p1.go();
}
public void go(){
JFrame frame=new JFrame();
B1.addActionListener(this);
public void actionPerformed(ActionEvent event){
B1.setText("abc");
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询