简体   繁体   English

在网页上获取Netbeans Applet

[英]Getting Netbeans Applet on Web Page

Okay, I am going to go through ALL my steps thus far just so that this process can be sped up hopefully. 好的,到目前为止,我将完成我的所有步骤,以便有希望加快这个过程。 I have done this before, but it was awhile back and I forgot how, but I know it is possible. 我以前做过这件事,但过了一段时间,我忘记了怎么回事,但我知道这是可能的。

  1. I made a Neatbeans created Java Application. 我做了一个Neatbeans创建的Java应用程序。 Then doing what this article said (and I rememeber doing this for the other program) I did the following: 然后做这篇文章所说的(我记得为其他程序做这个)我做了以下事情:
  1. Right-click the package containing your app and choose New | 右键单击包含应用程序的包,然后选择“新建”| Other. 其他。
  2. Select the Swing GUI Forms category and choose JApplet Form. 选择Swing GUI Forms类别,然后选择JApplet Form。 (This template is one of several applet templates, but this one is the one you want to create a JApplet that you can design in the GUI Builder.) (此模板是几个applet模板之一,但是这个模板是您要创建可以在GUI Builder中设计的JApplet的模板。)
  3. In the editor window, select the tab for the form that you want to convert to an applet. 在编辑器窗口中,选择要转换为applet的表单的选项卡。
  4. In the Inspector window, select the sub-components of the form and press Ctrl-C (or Ctrl-X) to copy them. 在“检查器”窗口中,选择表单的子组件,然后按Ctrl-C(或Ctrl-X)进行复制。
  5. In the editor window, select the tab for the JApplet form that you have just created. 在编辑器窗口中,选择刚刚创建的JApplet表单的选项卡。
  6. In the Inspector window, right-click the JApplet node and press Ctrl-V to paste the components. 在“检查器”窗口中,右键单击JApplet节点,然后按Ctrl-V粘贴组件。

2.After that I right-clicked my project "ConsulantsStaff" (yes it is spelled wrong) and I went to Web Start and made the following changes: 2.之后我右键单击了我的项目“ConsulantsStaff”(是的,拼写错误),然后我去了Web Start并进行了以下更改: 在此输入图像描述

3.I then ran Clean and Build, then uploaded the files from the projects "dist" folder online. 3.然后我运行Clean and Build,然后在线上传项目“dist”文件夹中的文件。 The files were: ConsulantsStaff.jar, launch.html, launch.jnlp 文件是:ConsulantsStaff.jar,launch.html,launch.jnlp

4.I then tried to incorporate that into a HTML file, which now looks like this: 4.然后我尝试将其合并到HTML文件中,现在看起来像这样:

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!-- ########################## IMPORTANT NOTE ############################ --><!-- This preview HTML page will work only with JDK 6 update 10 and higher! --><!-- ###################################################################### -->
    <html>
    <head>
    <title>Consulants Applet</title>
    </head>
    <body>
    <body bgcolor="#000000">
    <h3></h3>
    <script src="http://java.com/js/deployJava.js"></script>
    <script>
    var attributes = {
    code: "mypackage.consulantsstaff",
    archive: "consulantsstaff.jar",
    width: 800,
    height: 740
    };
    var parameters = {jnlp_href:"launch.jnlp"}; <!-- Applet Parameters -->
    var version = "1.5"; <!-- Required Java Version -->
    deployJava.runApplet(attributes, parameters, version);
    </script><!-- Or use the following applet element to launch the applet using jnlp_href --><!--
    <applet width="300" height="300">
    <param name="jnlp_href" value="launch.jnlp"/></applet>
    -->
    </body>
    </html>

So...yea, the only step I truly remember doing is step 1, the rest I am winging and so far it is not working. 所以...是的,我真正记得的唯一一步是第1步,其余的我正在向前迈进,到目前为止它还没有用。 The current location of this applet is here, it is just a black screen right now: Applet 这个小程序的当前位置在这里,它现在只是一个黑屏: Applet

Any and all help appreciated, -Austin (I have this post running on two sites as I need an answer ASAP, and thank you all in advance!) 任何和所有的帮助赞赏, - 奥斯汀(我有这个帖子在两个网站上运行,因为我需要尽快回答,并提前谢谢你们!)

java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
...
    at javax.swing.JFrame.setDefaultCloseOperation(JFrame.java:372)
    at consulantsstaff.UpdateUser.initComponents(UpdateUser.java:48)

Did you call .. 你打电话给..

JFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

..on line 48 of UpdateUser ? ..在UpdateUser第48行? That is my best guess. 这是我最好的猜测。 Even a trusted applet is not allowed to exit the VM (or to create a frame that does the same). 即使是受信任的applet也不允许退出VM(或创建执行相同操作的框架)。

BTW - you really should have figured this out before getting to 44 Kb of signed code! 顺便说一句 - 在获得44 Kb签名代码之前,你真的应该已经弄明白了!


Perhaps this app. 也许这个应用。 actually needs to be a JFrame based app. 实际上需要是一个基于JFrame的应用程序。 that is launched from a link using Java Web Start (for many reasons, including that a sand-boxed frame launched using JWS can make that method call without problems). 这是使用Java Web Start从链接启动的 (出于多种原因,包括使用JWS启动的沙盒 框架可以使该方法调用没有问题)。

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

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