title: How to link javascript file to java.awt.Canvas?
body: <p>I have an object of java.awt.Canvas and a javascript file canvas.js</p>
  
  <p>canvas.js contains:</p>
  
  <pre><code>var c = document.getElementById("myCanvas");
  var ctx = c.getContext("2d");
  ctx.fillStyle = "#FF0000";
  ctx.fillRect(0,0,150,75);
  </code></pre>
  
  <p>Then the canvas.js is loaded to ScriptEngine by:</p>
  
  <pre><code>ScriptEngine se = new LoadEnabledRhinoEngineFactory().getScriptEngine();
  try {
      se.eval("loadScript('/home/ani/canvas.js');");
  } catch (Exception e) {
      e.printStackTrace(System.err);
  }
  </code></pre>
  
  <p>Now I want canvas.js to draw on java.awt.Canvas object. Is it possible, if yes then how if not what is the alternative?</p>