title: How do I get user input in a GUI using text field?
body: <p>I'm working on a project that needs a GUI. How do I get the input for two given strings from the user using JTextField and display the output?</p>
  
  <p>My code:</p>
  
  <pre><code>public static void main(String[] args) {
      // TODO code application logic here
      Scanner user_input = new Scanner(System.in);
      String s ;
      System.out.println("Enter the Barcode:");
  
      s = user_input.next();
      String z;
      System.out.println("Enter the Serial Number:");
  
      z = user_input.next();
      Random r = new Random();
      int low = 1;
      int high = 21;// Set the number of random methods
      int rand = r.nextInt(high - (low - 1)) + low;
  }
  </code></pre>