title: displaying jtextfield data in jlablel on keyPressed event
body: <p>i need to erase  data in jlabel via jtextfield whenever i pressed backspace or delete from current position.I figure out how to add data in jlable(numeric data) but don't know how to erase it or edit it.   </p>
  
  <p>//this is my code </p>
  
  <pre><code>            String  str = "";
  
         private void jTextField1KeyPressed (java.awt.event.KeyEvent evt) {                                       
  
             char ch=evt.getKeyChar();
  
              if(Character.isDigit(ch)
                 str += ch; 
  
              jLabel2.setText(str);
          }
  
  
  
  } 
  </code></pre>