title: How can I repeat the process to display the current time?
body: <p>I'm trying to create a clock programm with customizable options but since I'm a beginner I'm running into some problems. I tried using the DigitalClock project but there's too many things in it for me right now
  I looked into Timer and ScheduledExecuterService but I don't know how to use and where to place them.
  I also tried to set a color to the background but the error was that it could be over ran.
  How can I repeat the process in milliseconds, add a background and make the code lighter ?</p>
  
  <pre><code>public Clock() {
      initComponents();
      Calendar cal = new GregorianCalendar();
      int second = cal.get(Calendar.SECOND);
      int minute = cal.get(Calendar.MINUTE);
      int hour = cal.get(Calendar.HOUR_OF_DAY);
      /////////////////////////////////////////////////////////////
      if (second &lt; 10){
          time.setText(" "+hour+": "+minute+":0"+second+"");
      }
      else if (minute &lt; 10){
          time.setText(" "+hour+":0"+minute+": "+second+"");
      }
      else if (hour &lt; 10){
          time.setText("0"+hour+": "+minute+": "+second+"");
      }
      else if (hour &lt; 10 &amp; minute &lt; 10){
          time.setText("0"+hour+":0 "+minute+": "+second+"");
      }
      else if (minute &lt; 10 &amp; second &lt; 10){
          time.setText(" "+hour+":0"+minute+":0"+second+"");
      }
      else if (hour &lt; 10 &amp; minute &lt; 10 &amp; second &lt; 10){
          time.setText("0"+hour+":0"+minute+":0"+second+"");
      }
      else {
          time.setText(hour + " : " + minute + " : " + second+"");
      }
      ////////////////////////////////////////////////////////////////
  
      }
  </code></pre>