WelcomeTest.java:37: 错误: 需要';'
}
^
1 个错误
加了分号
WelcomeTest.java:32: 错误: 找不到符号
btnn.addActionListener = new ActionListener(){ //监听事件
^
符号: 变量 addActionListener
位置: 类型为JButton的变量 btnn
注: WelcomeTest.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
1 个错误
代码修改
btnn.addActionListener = new ActionListener(){ //监听事件
public void actionPerformed(ActionEvent event){ //定义方法
String s = input.getText();
output.setText(“Hello “ +s+”,欢迎您参加Java考试!”);
}
}
btnn.addActionListener(new ActionListener(){ //监听事件
public void actionPerformed(ActionEvent event){ //定义方法
String s = input.getText();
output.setText("Hello"+s+",欢迎您参加Java考试!");
}
});
运行成功
注: WelcomeTest.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
不影响运行