1  import java.awt.*;
  2  import javax.swing.*;
  3  
  4  public class DisplayClock extends JFrame {
  5    public DisplayClock() {
  6      // Create an analog clock for the current time
  7      StillClock clock = new StillClock();
  8  
  9      // Display hour, minute, and seconds in the message panel
 10      MessagePanel messagePanel = new MessagePanel(clock.getHour() +
 11        ":" + clock.getMinute() + ":" + clock.getSecond());
 12      messagePanel.setCentered(true);
 13      messagePanel.setForeground(Color.blue);
 14      messagePanel.setFont(new Font("Courie", Font.BOLD, 16));
 15  
 16      // Add the clock and message panel to the frame
 17      add(clock);
 18      add(messagePanel, BorderLayout.SOUTH);
 19    }
 20  
 21    public static void main(String[] args) {
 22      DisplayClock frame = new DisplayClock();
 23      frame.setTitle("DisplayClock");
 24      frame.setLocationRelativeTo(null); // Center the frame
 25      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 26      frame.setSize(300, 350);
 27      frame.setVisible(true);
 28    }
 29  }