/* * Copyright (c) 1999-2002, Xiaoping Jia. * All Rights Reserved. * Modified by Alex Rudniy * */ import java.awt.*; /** * This is an ehhanced version of DigitalClock. It takes a parameter: color * It displays the time in the following format: * HH:MM:SS * And it takes another parameter: font * */ public class DigitalClock2 extends DigitalClock { public void init() { String param = getParameter("color"); if ("red".equals(param)) { color = Color.red; } else if ("blue".equals(param)) { color = Color.blue; } else if ("yelow".equals(param)) { color = Color.yellow; } else if ("orange".equals(param)) { color = Color.orange; } else { color = Color.green; } // read the parameter String paramFont = getParameter("font"); String fontName; // check if param is one of the applicable values then change font // if not, set font "DialogInput" if ("Serif".equals(paramFont)) { fontName = "Serif"; } else if ("Sans-serif".equals(paramFont)) { fontName = "Sans-serif"; } else if ("Monospaced".equals(paramFont)) { fontName = "Monospaced"; } else if ("Dialog".equals(paramFont)) { fontName = "Dialog"; } else { fontName = "DialogInput"; } // set font font = new Font(fontName, Font.BOLD, 48); } }