Signed Applet--please tell me something about the basics of it

Hi guys .

I am in the process of developing a GUI using an applet.The GUI involves reading a file given as input and parsing it for punctuaion errors.

This applet has to write to a file called "errors.txt" to report about errors.I came to know from a friend that applets do not have access permissions to write files to disk .This feature can be achieved using Signed Applets .If there is anyone who can tell me about the basics of Signed Applets then please help me as to how I can make changes in my program and elsewhere so that my program is able to do that.

My program is as follows(if youm need it):

import java.io.*;

import java.awt.*;

import java.applet.*;

public class textcopy extends Applet

{

public void init()

{

Choice ch=new Choice();

ch.addItem("Click Next to continue.");

ch.addItem("Framework Properties");

Label l1=new Label(" ");

Label nm=new Label("Please specify the errors that you want to be checked for in the file:");

Label a1=new Label("Write the pathname here:");

ta=new TextArea(1,20);

B=new Button("OK");

Checkbox b1=new Checkbox("Punctuation errors");

Checkbox b2=new Checkbox("Finding whether a key string is misspelt");

Label l2=new Label("Please select the key string from one of these:");

add(a1);

add(ta);

add(B);

add(l1);

add(nm);

add(b1);

add(b2);

add(l2);

add(ch);

}

TextArea ta;

Button B;String str="";

public boolean action(Event e,Object obj)

{

if(e.target instanceof Button)

{

repaint();

return true;

}

return false;

}

public void paint(Graphics g)

{

String s=ta.getText();

try{

FileReader fin=new FileReader(s);

PrintWriter fout=new PrintWriter(new BufferedWriter(new FileWriter("c:\\avichal\\java\\errors.txt")));

parse(fin,fout);

fin.close();

fout.close();

}

catch(IOException e)

{

Label avi=new Label("********!!!");

add(avi);

//g.drawString("SOme Error",500,300);

//e.printStackTrace();

}

}

public static void parse(FileReader fin,PrintWriter fout)throws IOException

{

String str="Punctuation Errors:\n"; /*Heading*/

fout.println(str);

fout.println("========================================================");

int i=0,j=0,k=0,l=0;

j=fin.read();

do{

do{

i=j;

j=fin.read();

}while((!((char)i=='('&&(char)j=='R'))&&(j!=-1));

if(j==-1)break;

j=fin.read();

j=fin.read();

j=fin.read();

j=fin.read();

j=fin.read();

j=fin.read();

j=fin.read();

char refnum[]=new char[5];

l=0;

while((char)j!=')')

{

j=fin.read();

if((char)j!=')')

refnum[l++]=(char)j;

}

fout.write("REF. NUM: ");

for(int a=0;a<l;a++)fout.write(refnum[a]);fout.write(": ");

j=fin.read();

l=0;

do{

i=j;

j=fin.read();

if((char)i=='\n')

{

k++;

//'k' gives the line no. and finally the no. of lines and neglects the lines before first occurence of "Ref Num

}

if(((char)i==',')&&((char)j!=' '))

{

l++;

String st=l+". error at line number "+ (k+1) + ": There should be "+

"a space after comma(,) \n";

fout.println(st);

}

if(((char)i=='.')&&((char)j!=' '))

{

l++;

String st=l+". error at line number "+ (k+1) + ": There should be "+

"a space after period(.) \n";

fout.println(st);

}

if(((char)i=='.')&&((char)j=='.'))

{

l++;

String st=l+". error at line number "+ (k+1) + ": There should not be "+

"two periods(.) together \n";

fout.println(st);

}

if(((char)i==' ')&&((char)j=='.'))

{

l++;

String st=l+". error at line number "+ (k+1) + ": There should not be "+

"a space before a period(.) \n ";

fout.println(st);

}

}while((!((char)i=='-' && (char)j=='T')) && j!=-1);

fout.println(" ");

/*if(l==0)

fout.println("No errors!!!!");*/

if(j==-1)break;

}while(j!=-1);

}

}

>

[4467 byte] By [avichal167] at [2007-9-30 11:42:15]
# 1

You need to understand many concepts before you start work on .

Here is some useful links for you

1. http://mindprod.com/jgloss/signedapplets.html

2. http://java.sun.com/products/plugin/reference/codesamples/index.html examples of 1.4 plugin

3. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/contents.html

4. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/faq/basics.html

5. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/rsa_signing.html

minimola at 2007-7-4 13:04:03 > top of Java-index,Security,Signed Applets...