Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of

When the applet is clicked upon, the number of milliseconds that have passed since january 1st 1970 will be stored in the variable time and shown in the Label :

    long time = System.currentTimeMillis ( ) ;
    lbl.setText ( time + "" ) ;

Very useful for determining elapsed time in milliseconds.

Not that convenient for determining what time it is on the station running this applet.

System's full designation is java.lang.System, so it's part of the java.lang package, that's always available, doesn't need an import.

All methods in the System class can be called with the name of the class,System, up front. More on this in the Statics lesson.

Text placed in the Label will be centered :

    lbl = new Label
      ( "==================", Label.CENTER ) ;

Label.CENTER is a constant in the Label class, value 1 .




Convenient ways for dealing with date and time can be found in our Dating lessons.