title: InputVerifier and multiple fields
body: <p>I am working on a form that provides "real-time" validation to the user and I have one problem.</p>
  
  <p>The goal is to put a label near the field (in this case a JSpinner), to show the user if the data is accepted or denied, in the same way that javascript-based validators do.</p>
  
  <p>The problem is that for archieving this, <strong>I need to set the value for the corresponding label</strong> and the only way I have found to do this is to create as many verifiers as fields, this way:</p>
  
  <pre><code>class MyVerifier extends InputVerifier{
  
      static final double MAX_VALUE = 30;
  
      @Override
      public boolean verify(JComponent input) {
          JTextField tf = (JTextField) input;
          Double value = Double.parseDouble(tf.getText().replace(',', '.'));
          return (value&gt;1);
      }
  
      @Override
      public boolean shouldYieldFocus(JComponent input) {
          boolean isValid = super.shouldYieldFocus(input);
      if (isValid) {
              jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("resources/accept.png")));
              jLabel1.setText("");
      } else {
              jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("resources/exclamation.png")));
              jLabel1.setText("The number of items must be greater than 1");
      }
          return true;
      }
   }
  </code></pre>
  
  <p>Then, the same code for jLabel2... It must be another way to do this.</p>
  
  <p>Thanks in advance.</p>