title: Cancel button showDialogInput issues
body: <pre><code> NumberFormat numForm = NumberFormat.getCurrencyInstance();
      double itemPrice;
      String s = (String)JOptionPane.showInputDialog("Enter item price:");
      if (s.equals("") || s == null) {
  
  
      } else {
          try{
  
              itemPrice = Double.parseDouble (s);
              recordPurchase(itemPrice);
              txtPrice.setText(numForm.format(itemPrice));
  
              double subtotal = getPurchase();     
  
              txtSubtotal.setText(numForm.format(subtotal));
              int items = getItems();
              String totalItems = Integer.toString(items);
              txtItems.setText(totalItems);
  
          } // end try
          catch (NumberFormatException e) {
              JOptionPane.showMessageDialog(this, "You must enter positive numeric data!");
          } // end catch
      } // end if Else
  </code></pre>
  
  <p>I am currently working on a program.My issue is in the if statement where I check to see if the user hits okay with nothing in the box OR they select cancel. I get a NullPointerException error only when cancel is clicked. If anyone could clarify as to why this happens it would be greatly appreciated.</p>