200分求一個小程序 这个程序不难吧,你将文本中内容写到文件中去就是了,用file类, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 is it difficult for,help me please.thnak you! 以下是鄙人的看法,不对之处请指正:由于 Applet 可以在网上自动下载,JVM 执行 Applet 时,对 Applet 的限制很多,比如“限制Applet对本地硬盘的操作”,“进行数据库操作时也有不少限制”我认为用Applet实现这个功能不是一个好办法,何不用Php,Jsp(如果主页空间支持的话)?另外,数据最好放在数据库中 not possible by using applet, unless you want to get digital certifercate for that 这个是读签名后读本地文件的applet,import java.awt.*;import java.awt.event.*;import java.applet.*;import java.io.*;public class FileReaderApplet extends Applet {boolean isStandalone = false;TextField fileNameField;TextArea fileArea;file://Get a parameter valuepublic String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def);}file://Construct the appletpublic FileReaderApplet() {}file://Initialize the appletpublic void init() {try {jbInit();}catch(Exception e) {e.printStackTrace();}}file://Component initializationprivate void jbInit() throws Exception {this.setSize(new Dimension(400,300));this.setLayout(new BorderLayout());Panel panel=new Panel();Label label=new Label("File Name");panel.add(label);fileNameField=new TextField(25);panel.add(fileNameField);Button b=new Button("Open File");b.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){loadFile(fileNameField.getText());}});panel.add(b);this.add(panel,BorderLayout.NORTH);fileArea=new TextArea();this.add(fileArea,BorderLayout.CENTER);}public void loadFile(String fileName){try{BufferedReader reader=new BufferedReader(new FileReader(fileName));String context=new String();while((context=reader.readLine())!=null){fileArea.append(context+"/n");}reader.close();}catch(IOException ie){fileArea.append(ie.getMessage());}catch(SecurityException se){fileArea.append("because of security constraint ,it can not do that!");}}file://Get Applet informationpublic String getAppletInfo() {return "This is an applet can read and write the local file system";}} 这是不可能办到的,除非你的主页空间所在的服务器允许你使用CGI, ASP, JSP等。 谢谢大家,我要得其实就是一个FTP上传程序,知道主机的地址,FTP的用户名,FTP的密码,然后上传一个文件到主机中,就是这样。我继续等待,再次谢谢大家。我的MAIL:[email protected] jacob问题,急!!!! java简单的问题 新手 史上最全Java线程编程资料 File 高人请进 --> 如何将新建文件存放到指定的新建目录下, 文件和目录已创建, 就是不知道该怎么放 如何用NIO的非阻塞模式传输Object,急! 请问我要构造一个两维的string数组,使用哪个类 请问关于Jbuilder7中JDK与tomcat的设置问题。 JAVA中如何动态存储? java 请推荐一本好书 jdk的配置问题,随你要多少分,我的3000分全给你都行,急啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
另外,数据最好放在数据库中
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.*;public class FileReaderApplet extends Applet {
boolean isStandalone = false;
TextField fileNameField;
TextArea fileArea;file://Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}file://Construct the applet
public FileReaderApplet() {
}file://Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}file://Component initialization
private void jbInit() throws Exception {
this.setSize(new Dimension(400,300));
this.setLayout(new BorderLayout());
Panel panel=new Panel();
Label label=new Label("File Name");
panel.add(label);
fileNameField=new TextField(25);
panel.add(fileNameField);
Button b=new Button("Open File");
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
loadFile(fileNameField.getText());
}
});
panel.add(b);
this.add(panel,BorderLayout.NORTH);
fileArea=new TextArea();
this.add(fileArea,BorderLayout.CENTER);
}public void loadFile(String fileName){
try{
BufferedReader reader=new BufferedReader(new FileReader(fileName));
String context=new String();
while((context=reader.readLine())!=null){
fileArea.append(context+"/n");
}
reader.close();
}catch(IOException ie){
fileArea.append(ie.getMessage());
}catch(SecurityException se){
fileArea.append("because of security constraint ,it can not do that!");
}
}file://Get Applet information
public String getAppletInfo() {
return "This is an applet can read and write the local file system";
}}
我要得其实就是一个FTP上传程序,
知道主机的地址,FTP的用户名,FTP的密码,然后上传一个文件到主机中,
就是这样。
我继续等待,再次谢谢大家。我的MAIL:[email protected]