/* Copyright F. P. Marin ( April 07 13:12:53 1997 ) E-mail: felix@bloch.ciens.ucv.ve Permission to use, copy, modify and distribute this software and its documentation for NON-COMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies. F. P. Marin makes no representations or warranties about the suitability of the software, either express or implied, including but no limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. F. P. Marin shall not be liable for any damage suffered by license as a result of using, modifying or distributing this software or its derivatives. HTML code is */ import java.awt.*; import java.util.Date; public class Simple extends java.applet.Applet implements Runnable { Font f; FontMetrics fm; int x,y; String s; Thread watch=null; public void init() { int temp; String fss=getParameter("fontsize"); temp=( fss!=null ) ? Integer.parseInt(fss):16; f=new Font("TimesRoman",Font.BOLD,temp); fm=getFontMetrics(f); setBackground(Color.black); setForeground(Color.green); } public void start() { if ( watch==null ) { watch=new Thread(this); watch.start(); } } public void run() { while ( true ) { s=new Date().toLocaleString(); x=(size().width - fm.stringWidth(s))/2; y=(size().height + fm.getHeight())/2; repaint(); try { Thread.sleep(1000); } catch (InterruptedException e) {} } } public void paint(Graphics g) { g.setFont(f); g.drawString(s,x,y); } public void stop() { if ( watch!=null ) { watch.stop(); watch=null; } } }