davidchew
May 5th, 2000, 07:45 PM
Something is wrong but dont know why.
In the html, the applet is shown as follows:
<applet code="DigitalThreads.class" width=100 height=25>
<param name="DATE" value="957539317">
</applet>
My program for the applet is as follows:
long fromcgi = Long.parseLong(getParameter("DATE"));
long fromcgi1 = fromcgi * 1000 ;
Font theFont = new Font("TimesRoman", Font.BOLD, 20);
Color mycolor = new Color(197,180,89);
Date theDate;
Thread runner;
public void start() {
if (runner == null); {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if (runner != null) {
runner.stop();
runner = null;
}
}
public void run() {
while (true) {
theDate = new Date();
repaint();
try { Thread.sleep(1000); }
catch (InterruptedException e) { } }
}
public void paint(Graphics g) {
g.setFont(theFont);
setBackground(mycolor);
setForeground(Color.black);
long duration = (theDate.getTime() - fromcgi1)/1000;
String durationString = "Run out time" ;
if (duration < (60 * 60 * 24 ) ) {
long hour = duration/(60 * 60);
long min = duration % (60 * 60);
long minx = min/60 ;
long secs = min % 60 ;
durationString = Long.toString(hour)+ ":" +Long.toString(minx)+ ":" + Long.toString(secs) ;
}
g.drawString(durationString,5,17);
}
}
Notice The first line on my applet programing is as follows:
long fromcgi = Long.parseLong(getParameter("DATE"));
But the applet wont run when I include the above line.
It was running before I included the line.
Any ideas ?
In the html, the applet is shown as follows:
<applet code="DigitalThreads.class" width=100 height=25>
<param name="DATE" value="957539317">
</applet>
My program for the applet is as follows:
long fromcgi = Long.parseLong(getParameter("DATE"));
long fromcgi1 = fromcgi * 1000 ;
Font theFont = new Font("TimesRoman", Font.BOLD, 20);
Color mycolor = new Color(197,180,89);
Date theDate;
Thread runner;
public void start() {
if (runner == null); {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if (runner != null) {
runner.stop();
runner = null;
}
}
public void run() {
while (true) {
theDate = new Date();
repaint();
try { Thread.sleep(1000); }
catch (InterruptedException e) { } }
}
public void paint(Graphics g) {
g.setFont(theFont);
setBackground(mycolor);
setForeground(Color.black);
long duration = (theDate.getTime() - fromcgi1)/1000;
String durationString = "Run out time" ;
if (duration < (60 * 60 * 24 ) ) {
long hour = duration/(60 * 60);
long min = duration % (60 * 60);
long minx = min/60 ;
long secs = min % 60 ;
durationString = Long.toString(hour)+ ":" +Long.toString(minx)+ ":" + Long.toString(secs) ;
}
g.drawString(durationString,5,17);
}
}
Notice The first line on my applet programing is as follows:
long fromcgi = Long.parseLong(getParameter("DATE"));
But the applet wont run when I include the above line.
It was running before I included the line.
Any ideas ?