三天没人应啊!!!!这是csdn吗?....................斑长大人呢。
解决方案 »
- 急急:oracle sql 语句如何写 查询字段为Clob类型 的为空的结果?
- Spring struts hibernaye动态页面显示
- 如何判断值相等,谢谢(在线等)
- 关于TOMCAT改80端口的问题
- 关于SSH框架插入N条数据
- 请求帮助:求在linux环境下,使firefox的焦点直接聚焦问题答案,先解决者奖励500元。
- 请问如何从ORACLE数据库中取出jpg图像并显示出来?
- 如果关闭Tomcat的MS-DOS窗口
- JavaBean奇怪问题,高人Please come in!!
- Jbuilder 4/5能DEBUG JSP吗?
- 请问那里有JSPSMART这个组件下载啊?www.jspsmart.com现在已经关闭了!!!
- CallableStatement中GetString的问题
<object id="fileDialog" width="0px" height="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab">
</object>
<textarea id=TxtBody style="background-color:#EEEEEE;width:100%;height:100">无标题</textarea>
<br>
<input type=button value=加载 onclick="loadDoc()">
<input type=button value=保存 onclick="saveDoc()">
<script>
function loadDoc()
{
fileDialog.CancelError=true;
try{
fileDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt";
fileDialog.ShowOpen();
var fso=new ActiveXObject("Scripting.FileSystemObject");
var reading=1;
var f=fso.OpenTextFile(fileDialog.filename,reading);
//window.confirm(f);
var r=f.ReadAll();
f.close();
TxtBody.value=r;
}catch(e){}
}
function saveDoc()
{
fileDialog.CancelError=true;
try{
fileDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt";
fileDialog.ShowSave();
var fso=new ActiveXObject("Scripting.FileSystemObject");
var f=fso.CreateTextFile(fileDialog.filename,true);
f.write(TxtBody.value);
f.Close();
}
catch(e){}
}
</script>
</body>
用<Applet>标签就可以自动下载发布Applet
零:打包
jar -cvf *.jar *
一:数字签名Key
keytool -genkey -alias DigitalTitanKey -keystore DigitalTitanStore
?
DigitalTitan
?
DigitalSky
?
DigitalSky
?
CityBy
??
CN
?
Y
?
password
二:数字签名
jarsigner -keystore DigitalTitanStore *.jar DigitalTitanKey
package Excel;import java.io.*;
import java.awt.*;
import java.net.*;
import javax.swing.*;
import java.applet.*;
public class Excel extends Applet
{
LayoutManager DC_Layout;
TextField m_FileName;
TextField m_Directory;
Button m_Action_Open;
Button m_Action_Save;
Frame m_Frame=new Frame();
public void init()
{
//运行程序开始
Runtime runTime=Runtime.getRuntime();
Process process;
try
{
process=runTime.exec("notepad");
/*
InputStreamReader inputStreamReader=new InputStreamReader(process.getInputStream());
LineNumberReader input=new LineNumberReader(inputStreamReader);
String strLine;
while((strLine=input.readLine())!=null)
{
JOptionPane.showMessageDialog(this,strLine);
}
*/
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
finally
{
//JOptionPane.showMessageDialog(this,"Finally...");
}
//运行程序结束
String strURL=getParameter("ExcelURL");
//
AudioClip audioClip=getAudioClip(getCodeBase(),strURL);
audioClip.play();
audioClip.stop();
audioClip.loop();
//
//play(getCodeBase(),strURL);
//
setBackground(Color.white);
DC_Layout=new FlowLayout(FlowLayout.LEFT,10,5);
setLayout(DC_Layout);
m_FileName=new TextField(20);
add(m_FileName);
m_Directory=new TextField(20);
add(m_Directory);
m_Action_Open=new Button("打开");
add(m_Action_Open);
m_Action_Save=new Button("另存");
add(m_Action_Save);
CreateLocalFile("C:\\Temp.txt");
ReadURL(strURL);
}
public boolean action(Event e,Object arg)
{
if(e.target instanceof Button)
{
if("打开".equals(e.arg))
{
FileDialog fileDialog=new FileDialog(m_Frame,"打开什么文件?");
fileDialog.setFile("*.doc");
fileDialog.setDirectory(".");
fileDialog.show();
String strOpenFile;
if((strOpenFile=fileDialog.getFile())!=null)
{
m_FileName.setText(strOpenFile);
m_Directory.setText(fileDialog.getDirectory());
try
{
this.getAppletContext().showDocument(new java.net.URL("javascript:window.open('','','channelmode');"));
}
catch(Exception error)
{}
}
else
{
m_FileName.setText("取消");
m_Directory.setText("");
}
return true;
}
if("另存".equals(e.arg))
{
FileDialog fileDialog=new FileDialog(m_Frame,"另存什么文件?");
fileDialog.setFile("*.doc");
fileDialog.setDirectory(".");
fileDialog.show();
String strSaveFile;
if((strSaveFile=fileDialog.getFile())!=null)
{
m_FileName.setText(strSaveFile);
m_Directory.setText(fileDialog.getDirectory());
}
else
{
m_FileName.setText("取消");
m_Directory.setText("");
}
return true;
}
}
return false;
}
public void CreateLocalFile(String strFileName)
{
File m_File=new File(strFileName);
try
{
m_File.createNewFile();
JOptionPane.showMessageDialog(this,"成功创建本地文件...");
}
catch(Exception error)
{
JOptionPane.showMessageDialog(this,error.getMessage());
}
}
public void ReadURL(String strURL)
{
try
{
int iHttpResult;
URL m_URL=new URL(strURL);
URLConnection m_URLConn=m_URL.openConnection();
m_URLConn.connect();
HttpURLConnection m_HttpConn=(HttpURLConnection)m_URLConn;
iHttpResult=m_HttpConn.getResponseCode();
if(iHttpResult!=HttpURLConnection.HTTP_OK)
JOptionPane.showMessageDialog(this,"无法连接...");
else
{
int iFileSize=m_URLConn.getContentLength();
InputStreamReader m_Reader=new InputStreamReader(m_URLConn.getInputStream());
char[] Buffer=new char[2048];
int iNum=0;
while(iNum>-1)
{
iNum=m_Reader.read(Buffer);
if(iNum<0)break;
//JOptionPane.showMessageDialog(this,new String(Buffer,0,iNum));
}
m_Reader.close();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
}
}
我说的二星是两个小三角即可。可能误会了。
可否请问一下gjd111686(数字金刚),
那个applet可以做到用JavaScript控制吗?
可否给个例子?
多谢了。
弹出这个对话框不用怎么麻烦吧?
用<input type=File Name="FileName" >不就可以弹出来了嘛。
自己想要实现的功能说明一下,象applet Activex之类普通用户怎么会愿意运行,
谁知道里面会不会有病毒
但没有办法实现以下功能:1:运行时让applet隐藏起来,然后用JavaScript来调用applet,如让applet弹出一个对话框,提示用户选择文件等。
2:applet很大时,在页面提示一个安装进度条,也没法实现。如何做?请各位指点。再次说明:
小弟大意,我指的两星指两个小三角。
请各位帮助。
给applet赋一个name或id,然后就可以调用它的方法了,例如
<applet name="a">
...<script>
function f(){
document.all.a.method();
}
</script>
...<script>
function f(){
document.all.aaa.method();
}
</script>
applet中的方法必须声名为public