日期:2014-05-17 浏览次数:20964 次
public void paint(Graphics g) {
////WriteTxt("abc123");
////WriteEmpty();
g.drawString("1", 2, 20);
File filename = new File("c:\\IvoCall\\IvoCall.txt");
g.drawString("2", 2, 40);
try {
g.drawString("3", 2, 60);
this.IsCreatedFile();
g.drawString("4", 2, 80);
if (!filename.exists()) {
g.drawString("5", 2, 100);
filename.createNewFile();
g.drawString("6", 2, 120);
}
g.drawString("7", 2, 140);
BufferedWriter output = new BufferedWriter(new FileWriter(filename));
g.drawString("8", 2, 160);
output.write("123456");
g.drawString("9", 2, 180);
output.close();
g.drawString("10", 2, 200);
g.drawString("ok", 2, 220);
} catch (IOException e1) {
// TODOe 自动生成 catch 块
e1.printStackTrace();
}
}
public void WriteTxt(String strTxt) {
File filename = new File("c:\\IvoCall\\IvoCall.txt");
try {
this.IsCreatedFile();
if (!filename.exists()) {
filename.createNewFile();
}
BufferedWriter output = new BufferedWriter(new FileWriter(filename));
output.write(strTxt);
output.close();
} catch (IOException e1) {
// TODOe 自动生成 catch 块
e1.printStackTrace();
}
}
<script type="text/jscript">
function Aa() {
window.document.AppletTest.WriteTxt("123456d");
}
</script>
<applet codebase="."
code="AppletTest.class"
name="AppletTest"
width="320"
archive="AppleTest.jar"
height="240">
</applet>
<input type="button" value="确定" onclick="Aa()" />
public String TestBack(){
return "abc";
}
是可以弹出abc的。
function Aa() {
alert(window.document.AppletTest.TestBack());
}
/**
* added by Defonds
* @param filesInfo
* File Name1<