构造函数不能应用于给定类型 Timer

Constructor cannot be applied to given types Timer

它说

constructor Timer in class Timer cannot be applied to given types.
required:int, ActionListener.
found:no arguments.
reason: actual and formal argument lists differ in length.

cannot find symbol. symbol: method scheduleAtFixedRate

private void initBoard() {
  addKeyListener(new TAdapter());
  setFocusable(true);

  bricks = new Brick[N_OF_BRICKS];
  setDoubleBuffered(true);
  timer = new Timer();
  timer.scheduleAtFixedRate(new ScheduleTask(), DELAY, PERIOD);
}

您似乎从 javax.swing.Timer 而不是 java.util.Timer 导入了 Timer class。

您的文件开头需要以下语句:

import java.util.Timer;