Firstly, thank you very much for the replies...
I would sign the applet, but as I understand it, it's an expensive process (maybe I'm not understanding it right!). I read you needed to buy a certificate from VeriSign or a similar company, which costs more than I'm willing to pay for a school project.
I tried out the javascript and java applet route, and I can pass variables back and forth. However, I don't suppose there is a way in JavaScript to load an image into a variable? Is JavaScript powerful enough?
Here's what I've tried doing to test it out:
1. The webpage
Code:
<html>
<script>
function uploadImage () {
var image = new Image();
image.src = document.myForm.uploadfile;
document.myApplet.paintPicture(image);
}
</script>
<body bgcolor="#A0A0FF">
<h2><p align="center"><font color="white">Fusion of JavaScript and JApplets</font></p><hr></h2>
<center><form name="myForm">
<input type="button" value="Upload" name="upload" onclick="uploadImage();">
  
<input type="file" name="uploadfile">
</form></center>
<p align="center">
<applet code="myApplet.class" name="myApplet" height=310 width=410 MAYSCRIPT>
</p>
</body>
</html>
2. The Applet
Code:
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
public class myApplet extends Applet {
public static final int WIDTH=400, HEIGHT=300;
public BufferedImage image;
public void init () {
image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.createGraphics();
g.fillRect(0,0,WIDTH,HEIGHT);
setBackground(Color.white);
}
public void paintPicture (Image newimage) {
Graphics g = image.createGraphics();
g.drawImage(newimage, 0, 0, null);
repaint();
}
public static void main (String args[]) {
JFrame myFrame = new JFrame();
myApplet myapplet = new myApplet();
myapplet.init();
myapplet.start();
Container myPane = myFrame.getContentPane();
myPane.add("Center", myapplet);
myFrame.setSize(410, 310);
myFrame.setResizable(false);
myFrame.setVisible(true);
}
}
I'm sad to say... Nothing happens
... Sorry to bombard you with all this code. It's nice to have an expert to consult! Thanks again!
Bookmarks