title: How to input integer number in Swing?
body: <p>I have code </p>
  
  <pre><code>    NumberFormat format = NumberFormat.getIntegerInstance();
      format.setGroupingUsed(false);
  
      JFormattedTextField jtf = new JFormattedTextField(format);
  
      jtf.setValue(new Integer(0));
      jtf.setColumns(10);
  </code></pre>
  
  <p>but when I input characters in text field they stay printed until i switch to another text field. I need to forbid characters input totally, i mean when character is inputted i need to delete at the moment or make somehow for character to not even appear for processing by listener if that is possible and also not to appear in text field ofcourse. I mean only characters which are digits must appear.</p>