[英]Applet no initialized
I am writing this code and trying to run it using appletviewer . 我正在编写此代码,并尝试使用appletviewer运行它。
import java.awt.*;
import java.applet.*;
public class FirstApplet extends Applet
{
/* <applet code="FirstApplet" height=200 width=300>
</applet> */
public void paint(Graphics g)
{
g.drawString("First Applet program ",50,30);
}
}
I'm compiling it by javac FirstApplet.java and running it with appletviewer by writing Appletviewer FirstApplet.java 我正在通过javac FirstApplet.java进行编译,并通过编写Appletviewer FirstApplet.java与appletviewer一起运行
But, the problem is that I'm not getting the expected output . 但是,问题是我没有得到预期的输出。 Indeed it's just showing that the applet is not initialized .
确实,这只是表明applet尚未初始化。
Can anyone help me out with the above? 有人可以帮我解决上述问题吗? What should I do to make it run properly?
我应该怎么做才能使其正常运行? I'm running Windows 7, on a dual core processor with 3GB of ram.
我在具有3GB内存的双核处理器上运行Windows 7。 The version of java is jdk1.7.0_45.
Java的版本是jdk1.7.0_45。
Appletviewer requires a that the class be loaded from a HTML file containing an applet tag Appletviewer要求从包含applet标签的HTML文件中加载类
<applet code="FirstApplet" height=400 width=300></applet>
Some side notes: 一些注意事项:
java.applet.Applet
is incredibly old. java.applet.Applet
太老了。 Take a look at Swing's JApplet
JApplet
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.