简体   繁体   English

为什么Java Applet没有显示在我的Web浏览器上?

[英]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>

在此处输入图片说明

By Default Unsigned applet is blocked by browsers. 默认情况下,未签名的applet被浏览器阻止。

To run them go to control panel > java > security 要运行它们,请转到控制面板> Java>安全性

set security level to Medium. 将安全级别设置为中。

And Click on OK. 然后单击确定。 That's all. 就这样。 :) :)

在此处输入图片说明

Or to sign applet follow this url 或签署小程序,请遵循以下网址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM