我正在尝试编译此代码(如下),但我不断收到一条错误消息,说明
此行有多个标记
- 类型
ActionListener.actionPerformed(ActionEvent)
- 可序列化的类
static
final
serialVersionUID
类型的字段long
我对 Java 还是很陌生,我真的不知道发生了什么,你们都对我如何纠正这种不幸的情况有任何见解吗?
public class qq extends JFrame implements ActionListener, ItemListener {
// many fields here
public qq() {
// components initializing
// other code for window closing etc.
}
// actionPerformed is ActionListener interface method
// which responds to action event of selecting
// combo box or radio button
public void ationPerformed(ActionEvent e){
if (e.getSource() instanceof JComboBox){
System.out.println("Customer shops: " + freqButton.getSelectedItem());
}
else if (e.getSource() instanceof JRadioButton){
if (age1.isSelected() ){
System.out.println("Customer is under 20");
}
else if (age2.isSelected() ){
System.out.println("Customer is 20 - 39");
}
else if (age3.isSelected() ){
System.out.println("Customer is 39 - 59");
}
else if (age4.isSelected() ){
System.out.println("Customer is over 60");
}
}
}
// itemStateChanged is ItemListener interface method
// which responds to item event of clicking checkbox
public void itemStateChanged (ItemEvent e){
if (e.getSource() instanceof JCheckBox){
JCheckBox buttonLabel = (JCheckBox)
e.getItemSelectable();
if (buttonLabel == tradeButton){
if (e.getStateChange() == e.SELECTED) {
System.out.println("Customer is trade");
}
else
{
System.out.println("Customer is not trade");
}
}
}
}
public static void main(String args[]) {
qq cd = new qq();
// other code setting up the window
}
}