当前位置: 技术问答>java相关
一个令人郁闷的问题!!!
来源: 互联网 发布时间:2015-09-10
本文导语: import java.awt.*; import java.awt.event.*; public class Applet1 extends Frame { MenuBar bar=new MenuBar(); Menu m1=new Menu("ahit"); Menu m2=new Menu("sjkd"); MenuItem a1,a2,a3,a4; MenuItem b1,b2,b3,b4; public Applet1(){ a1=new MenuItem("open"); a2=new Menu...
import java.awt.*;
import java.awt.event.*;
public class Applet1 extends Frame {
MenuBar bar=new MenuBar();
Menu m1=new Menu("ahit");
Menu m2=new Menu("sjkd");
MenuItem a1,a2,a3,a4;
MenuItem b1,b2,b3,b4;
public Applet1(){
a1=new MenuItem("open");
a2=new MenuItem("nedj");
a3=new MenuItem("open");
a4=new MenuItem("open");
b1=new MenuItem("open");
b2=new MenuItem("open");
b3=new MenuItem("open");
b4=new MenuItem("open");
bar.add(m1);
bar.add(m2);
m1.add(a1);
m1.add(a2);
m1.add(a3);
m1.add(a4);
m2.add(b1);
m2.add(b2);
m2.add(b3);
m2.add(b4);
this.add(bar);
}
public static void main(String ss[]){
new Applet1();
}
}
编译后就是"Applet1.java": Error #: 300 : method add(java.awt.MenuBar) not found in class eee.Applet1 at line 36, column 6
的结果!
很郁闷,请大侠们解答!
import java.awt.event.*;
public class Applet1 extends Frame {
MenuBar bar=new MenuBar();
Menu m1=new Menu("ahit");
Menu m2=new Menu("sjkd");
MenuItem a1,a2,a3,a4;
MenuItem b1,b2,b3,b4;
public Applet1(){
a1=new MenuItem("open");
a2=new MenuItem("nedj");
a3=new MenuItem("open");
a4=new MenuItem("open");
b1=new MenuItem("open");
b2=new MenuItem("open");
b3=new MenuItem("open");
b4=new MenuItem("open");
bar.add(m1);
bar.add(m2);
m1.add(a1);
m1.add(a2);
m1.add(a3);
m1.add(a4);
m2.add(b1);
m2.add(b2);
m2.add(b3);
m2.add(b4);
this.add(bar);
}
public static void main(String ss[]){
new Applet1();
}
}
编译后就是"Applet1.java": Error #: 300 : method add(java.awt.MenuBar) not found in class eee.Applet1 at line 36, column 6
的结果!
很郁闷,请大侠们解答!
|
能结账了吗?:)