Initial
This commit is contained in:
82
java/COUNTER/Counter.java.old
Normal file
82
java/COUNTER/Counter.java.old
Normal file
@@ -0,0 +1,82 @@
|
||||
import java.awt.*;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Color;
|
||||
import java.util.Date;
|
||||
import java.awt.Frame;
|
||||
import java.awt.image.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
public class Counter extends java.applet.Applet implements Runnable
|
||||
{
|
||||
// private Thread mThread;
|
||||
private String mStrFileName;
|
||||
|
||||
public Counter()
|
||||
{
|
||||
}
|
||||
public void init()
|
||||
{
|
||||
mStrFileName=new String("counter.dat");
|
||||
repaint();
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
// InFile inFile;
|
||||
// System.out.println("Hello");
|
||||
// try{inFile=new InFile(getCodeBase(),mStrFileName);}
|
||||
// try{inFile.open(getCodeBase(),mStrFileName);}
|
||||
// catch(Exception exception){return;}
|
||||
// String strLine=new String();
|
||||
// try{strLine=inFile.readLine();}
|
||||
// catch(Exception exception){return;}
|
||||
// Integer iCounter=new Integer(strLine);
|
||||
// int counter=iCounter.intValue();
|
||||
// counter++;
|
||||
// strLine.valueOf(counter);
|
||||
// inFile.close();
|
||||
// OutFile outFile=new OutFile();
|
||||
// try{outFile.open(getCodeBase(),mStrFileName);}
|
||||
// catch(Exception exception){return;}
|
||||
// try{outFile.write(strLine);}
|
||||
// catch(Exception exception){return;}
|
||||
// outFile.close();
|
||||
}
|
||||
public void start()
|
||||
{
|
||||
InFile inFile;
|
||||
try{inFile=new InFile(getCodeBase(),mStrFileName);}
|
||||
catch(Exception exception){return;}
|
||||
String strLine=new String();
|
||||
try{strLine=inFile.readLine();}
|
||||
catch(Exception exception){return;}
|
||||
Integer iCounter=new Integer(strLine);
|
||||
int counter=iCounter.intValue();
|
||||
counter++;
|
||||
strLine=String.valueOf(counter);
|
||||
inFile.close();
|
||||
OutFile outFile;
|
||||
String str=new String(getCodeBase().toString());
|
||||
// try{outFile=new OutFile(getCodeBase(),mStrFileName);}
|
||||
// catch(Exception exception){return;}
|
||||
// try{outFile.write(strLine);}
|
||||
// catch(Exception exception){return;}
|
||||
// outFile.close();
|
||||
|
||||
|
||||
// if(mThread==null){mThread=new Thread(this);mThread.start();}
|
||||
}
|
||||
public void stop()
|
||||
{
|
||||
// if(null!=mThread){mThread.stop();mThread=null;}
|
||||
}
|
||||
// public void update(Graphics graphics)
|
||||
// {
|
||||
// paint(graphics);
|
||||
// }
|
||||
// public void paint(Graphics graphics)
|
||||
// {
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user