m*****k 发帖数: 731 | 1 我的eclipse 对如下报错误,必须comment掉@Override才行,我都要
疯了。
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class FooGUI {
public static void main(String[] args) {
//initialize GUI components
final JFrame jf = new JFrame("Hello world!"); //allows jf to be
accessed from inner class body
jf.add(new JButton("Click me"));
// pack and make visible on the Event-Dispatch Thread
SwingUtilities.invokeLater(new Runnable() {
@Override //不work, has to comment out
public void run(){
// TODO Auto-generated method stub
jf.pack(); //this would be a compile-time error if jf were
not final
jf.setLocationRelativeTo(null);
jf.setVisible(true);
}
});
}
} |
T****U 发帖数: 3344 | 2 object class没有run method, 你怎么override?
【在 m*****k 的大作中提到】 : 我的eclipse 对如下报错误,必须comment掉@Override才行,我都要 : 疯了。 : import javax.swing.JButton; : import javax.swing.JFrame; : import javax.swing.SwingUtilities; : public class FooGUI { : public static void main(String[] args) { : //initialize GUI components : final JFrame jf = new JFrame("Hello world!"); //allows jf to be : accessed from inner class body
|
z*******3 发帖数: 13709 | |
z*******3 发帖数: 13709 | 4 匿名类
【在 T****U 的大作中提到】 : object class没有run method, 你怎么override?
|
N***m 发帖数: 4460 | 5 are you using java 1.5?
【在 m*****k 的大作中提到】 : 我的eclipse 对如下报错误,必须comment掉@Override才行,我都要 : 疯了。 : import javax.swing.JButton; : import javax.swing.JFrame; : import javax.swing.SwingUtilities; : public class FooGUI { : public static void main(String[] args) { : //initialize GUI components : final JFrame jf = new JFrame("Hello world!"); //allows jf to be : accessed from inner class body
|
m*****k 发帖数: 731 | 6 1.6035
【在 N***m 的大作中提到】 : are you using java 1.5?
|
m*****k 发帖数: 731 | 7 Multiple markers at this line
- implements java.lang.Runnable.run
- The method run() of type new Runnable(){} must override a superclass
method
I believe my eclipse messed up,
I restarted eclipse, same error.
I will restart my win and see,
【在 z*******3 的大作中提到】 : 我可以 : 提示什么错误?
|
w**z 发帖数: 8232 | 8 override interface is the new feature added for jdk 6, double check your
Eclipse setting, by default it is using jdk 5 to compile.
【在 m*****k 的大作中提到】 : Multiple markers at this line : - implements java.lang.Runnable.run : - The method run() of type new Runnable(){} must override a superclass : method : I believe my eclipse messed up, : I restarted eclipse, same error. : I will restart my win and see,
|
z*******3 发帖数: 13709 | 9 我觉得楼上说得有道理
去preference->java->compiler里面看看
我的同事也有过类似的问题
当时就查java版本,默认是1.4
放狗搜出来的这句话我很喜欢
“This byzantine menu / dialog interface is typical of Eclipse's poor UI
design.”
【在 m*****k 的大作中提到】 : Multiple markers at this line : - implements java.lang.Runnable.run : - The method run() of type new Runnable(){} must override a superclass : method : I believe my eclipse messed up, : I restarted eclipse, same error. : I will restart my win and see,
|
m*****k 发帖数: 731 | |