public void actionPerformed(ActionEvent evt) { // Opens method // Checks if the button clicked was the // Enter Diver Data button. // If not, moves on to next if statment. // Otherwise it enters this if statement if ((evt.getSource() == name) || (evt.getSource() == enter)) { // Opens if statement //Retrives the text from the name text field and //assigns it to the variable nameText of //type String String nameText = name.getText(); lname.setText("Name: " + nameText); //After printing text to JLabel, hides the textfield name.setVisible(false); }// ends if statement if ((evt.getSource() == street) || (evt.getSource() == enter)) { // Opens if statement String streetText = street.getText(); lstreet.setText("Street: " + streetText); street.setVisible(false); }// ends if statement if ((evt.getSource() == city) || (evt.getSource() == enter)) { // Opens if statement String cityText = city.getText(); lcity.setText("City: " + cityText); city.setVisible(false); }// ends if statement if ((evt.getSource() == statezip) || (evt.getSource() == enter)) { // Opens if statement String statezipText = statezip.getText(); lstatezip.setText("State & Zip: " + statezipText); statezip.setVisible(false); }// ends if statement if ((evt.getSource() == nname) || (evt.getSource() == enter)) { // Opens if statement String relname = nname.getText(); lnname.setText("Name: " + relname); nname.setVisible(false); }// ends if statement if ((evt.getSource() == phone) || (evt.getSource() == enter)) { // Opens if statement String relphone = phone.getText(); lphone.setText("Phone: " + relphone); lphone.setForeground(Color.red); phone.setVisible(false); } if ((evt.getSource() == rel) || (evt.getSource() == enter)) { String relString = rel.getText(); lrel.setText("Relationship: " + relString); rel.setVisible(false); // If Edit button was clicked, set textfields to // visible for user to reenter information and // it sets the text that had been entered to // to an empty String, giving the appearance // that the text has been removed. } // Closes if statement if (evt.getSource() == edit) { // Opens else if // If edit button has been pressed // the following is set to visible name.setVisible(true); street.setVisible(true); city.setVisible(true); statezip.setVisible(true); // Relative's info nname.setVisible(true); phone.setVisible(true); rel.setVisible(true); lnname.setText("Name: "); lnname.setForeground(Color.black); lphone.setText("Phone: "); lphone.setForeground(Color.black); lrel.setText("Relationship: "); lrel.setForeground(Color.black); } // Ends if } // Ends actionPerformed method