@@ -0,0 +1,2757 @@
+package christmas;%0A%0Aimport java.awt.Dimension;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0Aimport java.util.Calendar;%0Aimport javax.swing.JFrame;%0Aimport javax.swing.JLabel;%0Aimport javax.swing.Timer;%0A%0Aimport static java.util.Calendar.*;%0A%0A/**%0A *  A program that counts down to Christmas.%0A *%0A *  @author  Joel Abrahamsson%0A *  @version %25G%25%0A */%0Apublic class Countdown extends JFrame%0A%7B%0A  private static long MILLIS_PER_DAY    = 86400000L;%0A  private static long MILLIS_PER_HOUR   = 3600000L;%0A  private static long MILLIS_PER_MINUTE = 60000L;%0A%0A  private Calendar christmas;%0A  private JLabel label;%0A%0A  /**%0A   *  Creates a new Coundown-object.%0A   */%0A  public Countdown()%0A  %7B%0A    super(%22Christmas countdown%22);%0A%0A    christmas = getChristmasCalendar();%0A%0A    setDefaultCloseOperation(EXIT_ON_CLOSE);%0A%0A    // Create label%0A    label = new JLabel(formatTimeString(getTimeToChristmas()), JLabel.CENTER);%0A%0A      label.setPreferredSize(new Dimension(320, 64));%0A%0A    getContentPane().add(label);%0A    pack();%0A%0A    // Create and start timer%0A    Timer timer = new Timer(250, new ActionListener()%0A    %7B%0A      public void actionPerformed(ActionEvent e)%0A      %7B%0A        label.setText(formatTimeString(getTimeToChristmas()));%0A      %7D%0A    %7D);%0A    timer.start();%0A  %7D%0A%0A  /**%0A   *  Formats a string from the given time.%0A   *%0A   *  @param milliseconds time in milliseconds%0A   *%0A   *  @return             formatted string%0A   */%0A  private String formatTimeString(long milliseconds)%0A  %7B%0A    long days = milliseconds / MILLIS_PER_DAY;%0A    milliseconds %25= MILLIS_PER_DAY;%0A%0A    long hours = milliseconds / MILLIS_PER_HOUR;%0A    milliseconds %25= MILLIS_PER_HOUR;%0A%0A    long minutes = milliseconds / MILLIS_PER_MINUTE;%0A    milliseconds %25= MILLIS_PER_MINUTE;%0A%0A    long seconds = milliseconds / 1000;%0A%0A    return String.format(%22%25d days %25d hours %25d minutes %25d seconds%22, days, hours, minutes, seconds);%0A  %7D%0A%0A  /**%0A   *  Returns a Calendar representing Christmas (December 24th) the current year.%0A   *%0A   *  @return Calendar-object representing Christmas%0A   */%0A  private Calendar getChristmasCalendar()%0A  %7B%0A    Calendar christmas = Calendar.getInstance();%0A%0A    christmas.set(Calendar.MONTH, 12);%0A    christmas.set(Calendar.DAY_OF_MONTH, 24);%0A%0A    return christmas;%0A  %7D%0A%0A  /**%0A   *  Returns the time left to Christmas (in milliseconds).%0A   *%0A   *  @return time left to Christmas (in milliseconds)%0A   */%0A  private long getTimeToChristmas()%0A  %7B%0A    Calendar calendar = Calendar.getInstance();%0A    calendar.setTimeInMillis(christmas.getTimeInMillis() - calendar.getTimeInMillis());%0A%0A    calendar.set(MONTH, 0);%0A%0A    return calendar.getTimeInMillis();%0A  %7D%0A%0A  public static void main(String%5B%5D args)%0A  %7B%0A    Countdown countdown = new Countdown();%0A    countdown.setVisible(true);%0A  %7D%0A%7D%0A

Create a program that countdown to Christmas (December 24th)