[英]Why java Applet isn't displaying on my web browser?
I made a very simple applet viewer in NetBeans. 我在NetBeans中制作了一个非常简单的applet查看器。 Then I made a HTML file to call that ".class" file.
然后,我制作了一个HTML文件来调用该“ .class”文件。 Both .class and HTML files are stored in the same folder.
.class和HTML文件都存储在同一文件夹中。 But once I run the HTML file (in my local host) in my web browser (I tried with all common browser), it can't display the applet.
但是,一旦我在Web浏览器中(在所有通用浏览器中尝试过)运行HTML文件(在本地主机中),它就无法显示该applet。 It shows the error that I attached.
它显示了我附加的错误。
[NOTE: I also tried to upload the files in my webhosting service, in public domain, but it shows the same error.] [注意:我也尝试过在公共域的网站托管服务中上传文件,但显示相同的错误。]
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stringpractice;
import java.awt.*;
import java.applet.*;
import javax.swing.*;
/**
*
* @author
*/
public class Applet extends JApplet {
public void paint(Graphics g){
super.paint(g);
System.out.println();
g.drawString(" Hello", 50, 50);
}
}
.HTML: .HTML:
<html>
<title>Applet Viewer</title>
<body>
<applet code="Applet.class" width="300" height="300">
</applet>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.