ClickListener无法解析为类型

时间:2014-02-21 03:46:00

标签: java eclipse

我在Eclipse中遇到此错误:ClickListener cannot be resolved to a type。可能是什么导致了这个?我尝试用ActionListener listener = new ClickListener();ClickListener listener = new ClickListener();替换ActionListener listener = new ActionListener();,但都没有解决问题。我已将我的所有代码包含在错误行之前:

/**
 * 
 * @author j
 *
 */

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class View extends JPanel implements ItemListener
{
  JCheckBox checkBox1;
  JCheckBox checkBox2;
  JCheckBox checkBox3;
  JCheckBox checkBox4;
  JCheckBox checkBox5;

  JRadioButton radioButton1;
  JRadioButton radioButton2;
  JRadioButton radioButton3;

  JButton submit;

  public View()
  {
    checkBox1 = new JCheckBox("Moscow");
    checkBox1.addItemListener(this);

    checkBox2 = new JCheckBox("Saint Petersburg");
    checkBox2.addItemListener(this);

    checkBox3 = new JCheckBox("Novosibirsk");
    checkBox3.addItemListener(this);

    checkBox4 = new JCheckBox("Yekaterinburg");
    checkBox4.addItemListener(this);

    checkBox5 = new JCheckBox("Nizhny Novgorod");
    checkBox5.addItemListener(this);

    radioButton1 = new JRadioButton("5 million");
    radioButton1.addItemListener(this);

    radioButton2 = new JRadioButton("10 million");
    radioButton2.addItemListener(this);

    radioButton3 = new JRadioButton("25 million");
    radioButton3.addItemListener(this);

    submit = new JButton("Submit");
    ActionListener listener = new ClickListener();
    submit.addActionListener(listener);

etc...

错误出现在:ActionListener listener = new ClickListener();上。 ClickListener以红色加下划线。

0 个答案:

没有答案