Java Time Calculator

If this page works you'll be able so see a small Java Swing Applet with the Java Time Calculator program written by Peter Troon. It might be a pain to get Java working on your system and sometimes look like its taking very long to load the page. In other situations the message with a text similar to "Loading Java Applet" is displayed and after a few minutes still nothing has happened. If you experience similar problems, you might want to read the "important notes" section below. The information below might help you to get it working on your system.

Important Notes

This page requires a Java-enabled browser. It is possible that your browser already is equipped with a correct version of the Java Runtime Environment Plugin. That would be a Plugin for JDK 1.2 or newer. In that case you shouldn't have much problems to access this page and view the Applet. Depending on the configuration of your browser, it might try to get the Java plugin and install it in order to try to load the Applet belonging to this page if the proper Java plugin is not installed. This might take a while so please be patient. It is also possible that your browser will prompt you with a Security warning and ask you to trust the Java plugin enough to be installed on your system. Note that this page will not work without the proper (version of the) Java plugin. If the installation of the Java plugin fails you might want to get it yourself using these pages from the Java Sun site. Please follow the steps and instructions mentioned on those pages to complete the installation succesfully.

About the Time Calculator

This small program can be used to add two or more time values to each other. The calculated result time is displayed. For instance: the addition of 1 minute and 2 seconds plus 1 minute and 3 seconds will result in 2 minutes and 5 seconds. You might wonder why this can be handy. Well... read the explanation below and be your own judge.

Your browser understands the <APPLET> tag but isn't running the applet, for some reason. Your browser is completely ignoring the <APPLET> tag!


You remember the times when you were recording tapes and you wondered how much songs fitted on a tape? Or even did some calculation on the length of the songs so that you could record the songs on the tape in such a way that they fitted exactly on the tape and that none of the songs had to end in the middle because there was no room left on the tape? I know that most persons don't record tapes anymore but burn their own CD's, but in a sitution similar to the one described above it can be handy if there is a program that can do the calculation for you. As a matter of fact: even if you are selecting the songs for a CD you want to create you might want to know the total length of the songs you have so far.

When adding times with each other you have to take minutes and seconds into account. Since a minute consists of 60 (and not 100) seconds, you have to think about that in your calculation. This program makes it easier for you, because the author of this Applet (Peter Troon) already thought of that.

The Java Applet

The Applet displayed here is a small Java Swing program that was written as an exercise. It is distributed within an executable Jar (Java Archive). If your browser doesn't show the applet properly it might be possible that your browser does not have a built-in Java Virtual Machine or that the proper version of Java (or newer) is not installed on your system. You can get the latest version of Java on the Java Sun site. Make sure you use Java version 1.3.1 or newer.

The Java Plugin

You might want to get the Java plugin for your browser yourself from the Java Sun Plugin page. This might be necessary when the automatic download and installation of the plugin fails for some reason. It is recommended to download the latest version of the Java Plugin or at least a release based on Java version 1.3.1.

How to run the Program

If the applet is displayed correctly, you should be able to use it instantly. Just enter a time in the field below the text "Enter Time" and press the "Add" button. If everything goes well the time you entered should be added and the total time should be equal to the time you just entered. Enter more times and press "Add" or the "Enter" button on your keyboard to calculate and see how the total time is updated everytime. If you have Java installed on your machine you might want to download the Jar with the code and run this program locally instead of via this page.

Starting the program using the Jar

If Java is installed properly on your system and the Java program is in your path environment settings you should be able to change to the directory where you placed the Jar file and run it from that directory using the following command (or something similar):

java -jar timecalc.jar

Java Time Calculator Standalone Version

A stand alone version of the Java Time Calculator (without frames and explanation text) can be found behind this link. Please use this link if you prefer the standalone version in a pop-up window.


The interface of this small program consists of a few output fields which display what the user has entered, how many times in total and what the total result of the times entered is. The interface also has some input buttons and one input field, which will be explaned below:

  • The input field below the "Enter Time" text is to enter the time into the applet. The time can be entered in several formats. If you want to enter 1 minute and 23 seconds you can enter it as 1:23, 1;23, 1.23, 1'23, 1"23, 1"23' or even 1 23. If you just enter a number, the program will assume that the number is the number of minutes you want to enter and zero seconds for the seconds part. So 4 will be translated into 4"00. If 4.3 is entered it will be translated into 4"03.
  • The LNF button is to switch between different Look and Feels. This applet supports the default Java Look and feel, Windows and Motif.
  • The Info button opens a dialog box with some additional information about the program.
  • The Add button adds the value of the entered time to the list of entered times.
  • The Clear button clears the list of entered times and sets the total time to zero.
  • The Remove button can be used to remove a selected time from the list of entered times. The total time will be updated as well.


Contact the author: Send an electronic mail to:
Peter's ICQ Number is: #3900785.

This page: Copyright © 2002 Peter A. J. Troon

Note: This page is part of the Peter Troon Site.