这可能是一个非常简单的问题,但是我有一个AbstractTable,在我的一栏中,我试图添加一个ChangeListener,但它给我一个错误,错误是:

The method actionListener(ChangeListener) in the type JSpinner is not applicable
    for the arguments (new ChangeListener(){})

这是我尝试在列中添加JSpinner的代码:
}else if (col == 4){
Date today = new Date();        //Creates new default date (Todays Date)
final JSpinner Spinner = new JSpinner(new SpinnerDateModel(today, null, null, Calendar.MONTH)); // Creates Date Spinner
Spinner.addChangeListener(new ChangeListener() {     //Error Here
      @Override
      public void stateChanged(ChangeEvent e) {
        // handle click
      }
    });
value = Spinner;

最佳答案

我想您导入的ChnageListener错误,您必须导入javax.swing.event.ChangeListener

09-05 18:30