title: How send image from java applet to javascript?
body: <p>I have code in JAVA</p>
  
  <pre><code>import java.applet.Applet; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.TextArea; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO;
  
  public class JavaScriptToJava extends Applet{
  
      TextArea textBox;
      Image img;
      MediaTracker tr;
      public void init(){
          setLayout(new FlowLayout());
          textBox = new TextArea(5,40);
          add(textBox);
      }
  
      public void appendText(String text){
          textBox.append(text);
  
             Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                  try {
                          //Get data from clipboard and assign it to an image.
                          //clipboard.getData() returns an object, so we need to cast it to a BufferdImage.
                          BufferedImage image = (BufferedImage)clipboard.getData(DataFlavor.imageFlavor);
  
  
                  }
                  //getData throws this.
                  catch(UnsupportedFlavorException ufe) {
                          ufe.printStackTrace();
                  }
  
                  catch(IOException ioe) {
                          ioe.printStackTrace();
                  }
      }       
  
  
  
  }
  </code></pre>
  
  <p>I need get this image in javascript. How do this?</p>
  
  <p>My main task is to copy the images from the clipboard and transfer it to the html page calling js</p>