Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8129043

deployJava.javafxString creates applet element and div element with same name

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: fx2.0
    • Component/s: deploy
    • Labels:
      None
    • Environment:

      Windows XP SP3 32-bit, Java 7.0.

      Description

      I was unable to make calls from JavaScript into a JavaFX applet.

      Here is the HTML generated deployJava.javafxString in deployFX.js:

      [code]
      <div id="fxapplet-1Overlay" style="width:200;height:150;position:absolute;background:white">
      <table width=200 height=150 border=0 cellpadding=0 style="border-width:0px;border-spacing:0px 0px;margin:0px;padding:0px;">
      <tr>
      <td align="center" valign="middle" style="vertical-align: middle;">
      <img src="web-files/javafx-loading-100x100.gif" alt="" width=80 height=80>
      </td></tr></table>
      </div>
      <div id="fxapplet-1" style="position:relative;left:-10000px"><applet code="dummy.class" id="fxapplet-1" width="200" height="150" VIEWASTEXT>
      <param name="background" value="008080">
      <param name="foreground" value="FFFFFF">
      <param name="javafx_version" value="2.0+">
      <param name="jnlp_href" value="FXjavascriptTest.jnlp">
      <param name="width" value="200">
      <param name="height" value="150">
      <param name="scriptable" value="true">
      <param name="separate_jvm" value="true">
      <param name="java_status_events" value="true">
      <param name="type" value="application/x-java-applet">
      <param name="javafx_applet_id" value="fxapplet-1">
      <img style="float: left; margin: 0px 10px 40px 10px" src="web-files//error.png" width="16" height="16" alt=""> <b>A Java plugin is required to view this content.</b><br>Make sure that <a href='http://java.com&#39;&gt;a recent Java runtime</a> is installed, and the Java plugin is enabled.
      </applet>
      </div>
      [/code]

      Note that the id for the second div element is the same as the id for the applet it embeds. This resulted in document.getElementById(appletId) returning the HTMLDivElement, rather than the applet. For a work around, I changed line 1189 in getAppletTagString to append "-applet" to the applet id. With that, document.getElementById(appletId + "-applet") returns the proper object, though I'm sure a more elegant solution may derived. It would also be nice if deployJava.javafx returned the id of the applet it creates.

        Attachments

          Activity

            People

            • Assignee:
              igor Igor Nekrestyanov (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: