@@ -0,0 +1,2584 @@
+import java.awt.Graphics;%0Aimport java.awt.Graphics2D;%0Aimport java.awt.GraphicsDevice;%0Aimport java.awt.GraphicsEnvironment;%0Aimport java.awt.Window;%0Aimport java.awt.Frame;%0Aimport java.awt.Canvas;%0Aimport java.awt.Color;%0Aimport java.awt.Font;%0Aimport java.awt.FontMetrics;%0Aimport java.awt.event.KeyEvent;%0Aimport java.awt.event.KeyListener;%0Aimport java.awt.geom.Rectangle2D;%0Aimport java.awt.Dimension;%0A%0Aimport java.lang.Math;%0Aimport java.lang.Thread;%0Aimport java.util.Random;%0Aimport java.util.Timer;%0Aimport java.util.TimerTask;%0Aimport java.time.LocalTime;%0A%0A%0Aclass ClockCanvas extends Canvas %7B%0A    public ClockCanvas() %7B%0A%09setBackground(Color.BLACK);%0A    %7D%0A    %0A    public void paint(Graphics g) %7B%0A%09g.setColor(Color.WHITE);%0A%0A%09LocalTime time = LocalTime.now();%0A%09String timeString = String.format(%22%25d:%2502d:%2502d%22, time.getHour(), time.getMinute(), time.getSecond());%0A%09%0A%09drawString(timeString, g);%0A    %7D%0A%0A    private void drawString(String timeString, Graphics g) %7B%0A%09Dimension dim = getSize();%0A%0A%09int fontSize = 1;%0A%09Font font = new Font(Font.MONOSPACED, Font.PLAIN, fontSize);%09%0A%09Font biggestFont = font;%0A%0A%09// Figure out the biggest font that fits.%0A%09while (true) %7B%0A%09    font = new Font(Font.MONOSPACED, Font.PLAIN, fontSize);%0A%09    FontMetrics fm = g.getFontMetrics(font);%0A%09    Rectangle2D rect = fm.getStringBounds(timeString, g);%0A%0A%09    if (rect.getWidth() %3C= dim.width &&%0A%09%09rect.getHeight() %3C= dim.height) %7B%0A%09%09biggestFont = font;%0A%09    %7D else %7B%0A%09%09break;%0A%09    %7D%0A%0A%09    fontSize++;%0A%09%7D%0A%0A%09// Draw the string.%0A%09g.setFont(biggestFont);%0A%09Rectangle2D rect = g.getFontMetrics().getStringBounds(timeString, g);%0A%09g.drawString(timeString,%0A%09%09     (int)(dim.width - rect.getWidth()) / 2,%0A%09%09     (int)(dim.height - rect.getHeight()) / 2 + (int) Math.abs(rect.getY()));%0A    %7D%0A%7D%0A%0Aclass ClockKeyListener implements KeyListener %7B%0A    public void keyPressed(KeyEvent e) %7B%0A%09if (e.getKeyCode() == KeyEvent.VK_ESCAPE) %7B%0A%09    System.exit(0);%0A%09%7D%0A    %7D%0A%0A    public void keyReleased(KeyEvent e) %7B%7D%0A    public void keyTyped(KeyEvent e) %7B%7D%0A%7D%0A%0Aclass Clock %7B%0A%0A    public static void main(String%5B%5D args) throws InterruptedException %7B%0A%09GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();%0A%09Frame frame = new Frame();%0A%09Canvas canvas = new ClockCanvas();%0A%09frame.add(canvas);%0A%0A%09KeyListener kl = new ClockKeyListener();%0A%09frame.addKeyListener(kl);%0A%0A%09gd.setFullScreenWindow(frame);%0A%0A%09TimerTask task = new TimerTask()%7B%0A%09%09public void run() %7B%0A%09%09    canvas.repaint();%0A%09%09%7D%0A%09    %7D;%0A%0A%09Timer timer = new Timer();%0A%09timer.scheduleAtFixedRate(task, 0, 1000);%0A%0A%09Thread.sleep(5000);%0A%09System.exit(0);%0A    %7D%0A%7D%0A

Add Clock.java