import java.awt.*;
import java.applet.*;
public class MyApplet extends Applet{
/**
*
*/
private static final long serialVersionUID = 1L;
String dString = "Value is null";
String gPath="";
public void get_path(){
gPath = this.getParameter("path");
if(gPath == null)
gPath = dString;
//setBackground(Color.cyan);
}
public void paint(Graphics g){
g.drawString(gPath, 20, 30);
}
}
HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title> Upload File </title>
<script type="text/javascript">
var sys_path;
function print_path(){
sys_path = document.getElementById('name').value;
document.app.get_path();
document.write(sys_path);
}
</script>
<applet code="MyApplet.class" name="app" width="300" height="200">
<param name="path" value="&{sys_path};">
</applet>
</head>
<body>
<form>
Path:<input type="text" id="name" \>
<input type="button" value="click" onClick="print_path();" />
</form>
</body>
</html>
Explanation:
In these code I'm trying to take input from text box and display in the applet. I'm trying this couple of days and unable to find a way. Please help me regarding this. Thanks in advance!