private void purchaseOnlineMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_purchaseOnlineMouseClicked

        //make a pop up when Purchase Online is Clicked
        createButton.setEnabled(false);
        cusID.setEditable(false);
        cusName.setEditable(false);
        cusAddress.setEditable(false);
        cusPhone.setEditable(false);
        cusPassword.setEditable(false);
    	
    	String customerID;
    	int iD;
    	String customerPassword;
    	int cancel;

    	// While customer ID's length is 0, keep prompting user to enter customer ID.
    
    	customerID = JOptionPane.showInputDialog("Please Enter Your Customer ID: ");
    	try {
    		iD = Integer.parseInt(customerID);
    	} catch (NumberFormatException e) {
    		buttonGroupCustomer.clearSelection();
    		return;
    	}
    	
    	try {
			while (!trans.checkCustomerID(customerID)) {
				customerID = JOptionPane.showInputDialog("Please Enter a VALID Customer ID: ");
		    	try {
		    		iD = Integer.parseInt(customerID);
		    	} catch (NumberFormatException e) {
		    		buttonGroupCustomer.clearSelection();
		    		return;
		    	}
			}


			JPasswordField passwordField = new JPasswordField();
			// * is what you will see when user enters password.
			passwordField.setEchoChar('*');

			Object[] obj = {"Please enter the password:\n", passwordField};
			Object[] obj2 = {"Wrong Password. Try Again: ", passwordField};
			Object stringArray[] = {"OK","Cancel"};
			cancel = JOptionPane.showOptionDialog(null, obj, "Need password", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, stringArray, obj);
			
			if(cancel==1) {
				// set radio button to not selected
				return;
			}
			
			customerPassword = new String(passwordField.getPassword());
			while (!trans.checkCustomerPassword(customerID, customerPassword)) {		
				passwordField.setText("");
				cancel = JOptionPane.showOptionDialog(null, obj2, "Try Again", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, stringArray, obj);
				if(cancel==1) {
					// set radio button to not selected
					return;
				}
				customerPassword = new String(passwordField.getPassword());
				passwordField.setText("");
			}
			if (customerPassword.isEmpty()) {
				// set radio button to not selected
				return;
			}		
			
	      	categoryField.setEditable(true);
	      	leadSingerField.setEditable(true);
	      	titleField.setEditable(true);
	      	quantityField.setEditable(true);
	      	search.setEnabled(true);  
	      	
			rid = trans.insertPurchase(Integer.parseInt(customerID));

    	} catch (HeadlessException e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    	} catch (SQLException e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
		}    	


    }//GEN-LAST:event_purchaseOnlineMouseClicked