Clock Program

I made this clock program, but having a little problem with it. Here is the following code I have:

import java.awt.*;
import java.applet.*;

public class Time extends Applet {

long tSec=2549000000L;
long hours=0;
long min=0,sec=0;
long days=0;

public void paint (Graphics g){

days=tSec/(60*60*24);
hours=tSec%(60*60*24)/(60*60);
min=tSec%(60*60)/60;
sec=tSec%60;

g.drawString ("Days: " + days, 50,50);
g.drawString ("Hours: " + hours, 50,80);
g.drawString ("Minutes: " + min, 50,110);
g.drawString ("Seconds: " + sec, 50,140);
}
}

I keep getting one error, but not quite sure what it is. Here is the other code you need to view it, but I'm guessing you guys know it.



Clock Program








If anyone can help me out that would be really great. Thanks in advance



Comments

  • Hi,

    What kind of error do you get? I compiled your applet and started it. It worked pretty fine. Is it possible, that you didn't activate JAVA for your browser? Does the file "Time.class" reside in the same folder as your html page?

    greetings moo
  • : Hi,
    :
    : What kind of error do you get? I compiled your applet and started it. It worked pretty fine. Is it possible, that you didn't activate JAVA for your browser? Does the file "Time.class" reside in the same folder as your html page?
    :
    : greetings moo
    :

    I see what I did. For some reason I put "public class Time extends Applet {", where Time should've been clock. Thanks for the help on that one, mistake on my part.

  • [b][red]This message was edited by amalgamut00 at 2003-10-1 21:13:57[/red][/b][hr]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories