java运行时提示错误:Exception in the thread "main" java. lang.nullPointerException?求指导 5
importjava.applet.*;importjava.awt.*;/**这是一个英汉词典的类*/publicclassDictionaryextendsApple...
import java.applet.*;
import java.awt.*;
/**
这是一个英汉词典的类
*/
public class Dictionary extends Applet {
Label chinese,english;
TextField chineseword,englishword;
Button checkword,addword;
public void init() {
chinese = new Label("中文");
english = new Label("英文");
chineseword = new TextField(16);
englishword = new TextField(16);
checkword = new Button("查找");
addword = new Button("添加");
setLayout(new FlowLayout());
add(chinese);add(chineseword);
add(english);add(englishword);
add(checkword);add(addword);
}
html:
<html>
<head>
<body>
<applet code="Dictionary" height=500 width=500 >
</applet>
</body>
</head>
</html> 展开
import java.awt.*;
/**
这是一个英汉词典的类
*/
public class Dictionary extends Applet {
Label chinese,english;
TextField chineseword,englishword;
Button checkword,addword;
public void init() {
chinese = new Label("中文");
english = new Label("英文");
chineseword = new TextField(16);
englishword = new TextField(16);
checkword = new Button("查找");
addword = new Button("添加");
setLayout(new FlowLayout());
add(chinese);add(chineseword);
add(english);add(englishword);
add(checkword);add(addword);
}
html:
<html>
<head>
<body>
<applet code="Dictionary" height=500 width=500 >
</applet>
</body>
</head>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询