当我点击设计标签时,我收到此错误:
public class ClikerGame {
private int x, y, xa = 2, ya = 2;
private Clicker clicker;
private Timer timer;
public ClikerGame(Clicker clicker) {
this.clicker = clicker;
timer = new Timer(15, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
x += xa;
y += ya;
if (x < 0 || x > 700 - 20) {
Music.music(1);
xa = -xa;
} else if (y < 0 || y > 500 - 20) {
Music.music(1);
ya = -ya;
}
Thread.sleep(15);
clicker.ball.setBounds(x, y, 30, 30);
clicker.ball.getParent().repaint();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error 1");
}
}
});
}
public void start() {
if (!timer.isRunning()) {
Music.music(2);
timer.start();
}
}
public void stop() {
timer.stop();
// Stop the music
}
}
我已在窗口&gt;首选项中检查:
我错过了什么吗?
答案 0 :(得分:1)
看起来JAVA_HOME设置为java 7,这需要重启吗?
您实际上是在使用Java 7执行eclipse,您可以将JAVA_HOME
更新为指向Java 8,然后重新启动eclipse(而不是您的计算机)。