You have to manipulate the
fullName
variable before displaying it.
Something along:
fullName = JOptionPane.showInputDialog(null,"What is your full name?");
fullName = fullName.trim().replaceFirst("\\s+", System.lineSeparator());
JOptionPane.showMessageDialog(null, "You entered:" + System.lineSeparator() + fullName);