title: user input count down timer using thread
body: <p>I have a GUI composed of 1 button, 1 text field, 1 label. It
  converts string to int from text field. decrement it by 1. print on label </p>
  
  <pre><code> @Override
      public void run() {
          while (runner == Thread.currentThread()) {
              try {
                  System.out.println("Step 1");
                  int count = Integer.valueOf(txt.getText());
                  System.out.println("Step 2");
                  while (count != 0) {
                      count--;
                      lblcount.setText("Time Left is " + Integer.toString(count));
                      Thread.sleep(1000);
                      System.out.println("Step 3");
                  }
              } catch (InterruptedException ie) {
                  System.out.println("error of some sort here step 4");
              }
          }
          repaint();
      }
  
      public static void main(String[] args) {
          Timed2 dd = new Timed2();
      }
  
      @Override
      public void actionPerformed(ActionEvent eve) {
          Object source = eve.getSource();
          if (source.equals(btncount)) {
              run();
          }
      } 
  </code></pre>
  
  <p>console error</p>
  
  <pre><code>Step 1
  Exception in thread "Thread-1" java.lang.NumberFormatException: 
  For input string: ""
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
  
      at java.lang.Integer.parseInt(Integer.java:504)
  
      at java.lang.Integer.valueOf(Integer.java:582)
  
      at timed2.Timed2.run(Timed2.java:42)
  
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>how do i change the thread to read the text box after user inputs number and not before thus giving me this error which means it counts down nothing </p>