0

I am working with NetBeans (Swing) and I need to get first name and last name in same dialog box (so those can be edited by user and saved). How do I do this? With this code below they appear in their own dialog boxes but everything else works.

private void editName(java.awt.event.ActionEvent evt) {                                              

String newName = JOptionPane.showInputDialog(this, "Name", people.get(current).getFirstName());
        if (newName != null)
            people.get(current).setFirstName(newName);
        update(people.get(current));

         newName = JOptionPane.showInputDialog(this, "LastName", people.get(current).getLastName());
        if (newName != null)
            people.get(current).setLastName(newName);
        update(people.get(current));           
    }
Ocelot
  • 9
  • 1
  • Have a look at this post. It'll surely be exactly what you are searching for: https://stackoverflow.com/questions/6555040/multiple-input-in-joptionpane-showinputdialog –  Apr 25 '18 at 20:10
  • 2
    Possible duplicate of [Multiple input in JOptionPane.showInputDialog](https://stackoverflow.com/questions/6555040/multiple-input-in-joptionpane-showinputdialog) – pointerless Apr 25 '18 at 21:02

0 Answers0