private void saveButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_saveButtonActionPerformed // TODO add your handling code here: try { String productName = nameField.getText().trim(); int price = Integer.parseInt(priceField.getText().trim()); if (productName.length() == 0) { JOptionPane.showMessageDialog( null, "Please enter a Product Name", "Warning Message", JOptionPane.WARNING_MESSAGE); } else { product.setPrice(price); product.setProdName(productName); priceField.setEditable(false); nameField.setEditable(false); saveButton.setEnabled(false); } } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog( null, "Please enter a valid Price", "Warning Message", JOptionPane.WARNING_MESSAGE); } } // GEN-LAST:event_saveButtonActionPerformed