java - Deploy Applet with JNLP -
i'm trying deploy applet new java jnlp specifications, receive following error java plugin console:
badfieldexception[ il campo <jnlp><applet-desc>width presenta un valore non valido: 0,0]
this html code:
<script> var attributes = { id:'signingapplet', code:'it.insielmercato.web.signing.signingapplet' ,width:0, height:0 } ; var parameters = {jnlp_href: 'signing-applet.jnlp'} ; deployjava.runapplet(attributes, parameters, '1.6'); function setclipboardtext(text){ signingapplet.setclipboardcontent(text); } </script>
this jnlp code:
<?xml version="1.0" encoding="utf-8"?> <jnlp spec="1.5+" codebase="" href=""> <information> <title>signingapplet</title> <vendor>insielmercato s.p.a.</vendor> </information> <resources> <!-- application resources --> <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/> <jar href="signing-1.0.jar" main="true" /> </resources> <applet-desc name="signing applet" main-class="it.insielmercato.web.signing.signingapplet" width="0" height="0"> </applet-desc> <update check="background"/> </jnlp>
and applet code:
package it.insielmercato.web.signing; import java.applet.applet; import java.awt.toolkit; import java.awt.datatransfer.clipboard; import java.awt.datatransfer.clipboardowner; import java.awt.datatransfer.dataflavor; import java.awt.datatransfer.stringselection; import java.awt.datatransfer.transferable; import java.awt.datatransfer.unsupportedflavorexception; import java.io.ioexception; public class signingapplet extends applet implements clipboardowner { /** * */ private static final long serialversionuid = 5272223219287676996l; private void loadappletparameters(){ } public void init(){ loadappletparameters(); } public void setclipboardcontent(string text){ stringselection ss = new stringselection(text); clipboard clipboard = toolkit.getdefaulttoolkit().getsystemclipboard(); clipboard.setcontents(ss, this); } public void lostownership(clipboard clipboard, transferable contents) { } public string getclipboardcontent(){ string content = null; clipboard clipboard = toolkit.getdefaulttoolkit().getsystemclipboard(); transferable contents = clipboard.getcontents(null); boolean hastransferabletext = (contents != null) && contents.isdataflavorsupported(dataflavor.stringflavor); if(hastransferabletext) try { content = (string)contents.gettransferdata(dataflavor.stringflavor); } catch (unsupportedflavorexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } return content; } }
where going wrong?
since "presenta un valore non valido" apparently translates "presents non valid value" try changing width , height 0 20.
use css (cascading style sheets) make applet hidden or invisible.
Comments
Post a Comment