title: How do I add variables in JOptionPane.showInputDialog
body: <p>I´m really new to java and GUI´s but I´m trying to implement the &quot;guess the number game&quot; to an app.
  I want to change the max and min variables here <strong>n = Integer.parseInt(JOptionPane.showInputDialog (&quot;Choose a number between [%d,%d]:&quot;), min, max);</strong> to make the game easier.
  Obviously this doesn´t work, but it´s the end goal. Any advice? Thanks</p>
  <pre><code>import javax.swing.JOptionPane;
  import javax.swing.JTextField;
  
  public class guessTheNumber {
      public static void main(String[] args) {
          int nAttempts= 0, min = 0, max = 100;
          int n = 0, nRandom = (int)( Math.random() * (( max - min ) + 1 )) + min;
          do
          {
              nAttempts++;
              n = Integer.parseInt(JOptionPane.showInputDialog (&quot;Choose a number between [%d,%d]:&quot;), min, max);
              
              if ( n != nRandom)
              {
                  if( n &gt; nRandom )
                  {
                      JTextField.
                      JOptionPane.showMessageDialog(null, &quot;Too High&quot;,&quot;Wrong Number&quot;, JOptionPane.INFORMATION_MESSAGE);
                  }
      
                  if( n &lt; nRandom )
                  {
                      JOptionPane.showMessageDialog(null, &quot;Too Low&quot;,&quot;Wrong Number&quot;, JOptionPane.INFORMATION_MESSAGE);
                  }
              }
          } while ( n != nRandom);
          JOptionPane.showMessageDialog(null, &quot;Congrats!! Attempts = &quot;+ nAttempts,&quot;Level finished&quot;, JOptionPane.WARNING_MESSAGE);
      }
  }
  </code></pre>