本鸟是只JAVA菜鸟,按照教程在新安装的JB8.0中输入源代码,但是立刻提示有错:" Cannot access class java.applet.Applet; file java\applet\Applet.class not found at line 3" 请问这是怎么回事?难道是安装的JB不全吗?怎么解决?谢谢了!
...全文
209打赏收藏
菜鸟问问题,求解答!!
本鸟是只JAVA菜鸟,按照教程在新安装的JB8.0中输入源代码,但是立刻提示有错:" Cannot access class java.applet.Applet; file java\applet\Applet.class not found at line 3" 请问这是怎么回事?难道是安装的JB不全吗?怎么解决?谢谢了!
你的程序错误真多.呵呵
import javax.swing.*;
import java.awt.*;
public class FontsApplet extends JApplet
{// creat two label components
JLabel lblName= new JLabel("ericfox");
JLabel lblPhone= new JLabel("555-1111");
// creat two fonts
Font fntName= new Font("Serif",Font.ITALIC,14);
Font fntPhone= new Font("Sans Serif",Font.BOLD,12);
public void init()
{ // set colors and font;add labels
setBackground(Color.cyan);
lblName.setFont(fntName);
add(lblName);
lblPhone.setFont(fntPhone);
lblPhone.setForeground(Color.red);
add(lblPhone);
}
public static void main(String[] args){
//做自己的事情
import java.Applet.Applet;
import jave.awt.*;
public class FontsApplet extends Applet
{// creat two label components
Label lblName= new Label("ericfox");
Label lilPhone= new Label("555-1111");
// creat two fonts
Font fntName= new Font("Serif",Font.ITALIC,14);
Font fntPhone= new Font("Sans Serif",Font.BOLD,12);
public void init()
{ // set colors and font;add labels
setBackground(Color.cyan);
lblName.setFont(fntName);
add(lblName);
lblPhone.setFont(fntPhone);
lblPhone.setForeground(Color.red);
add(lblPhone);
}
}
我后来没有用JB来RUN, 直接用JDK来编译,但是还是提示有错误,而且错误更多了?跟JDK的版本有关? 我用的是教程自带光盘的JDK1.3.1啊!谢谢了!