0
In the following code, it asks to be filled in the name, but if you do not enter anything, and I click cancel it returns a message (The name you entered was Null).
My question is how do I stop when clicking cancel it directly close the application or appear another message, do not appear the "null".
Follow the code part:
mensagem.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String nome;
nome = JOptionPane.showInputDialog("Qual seu nome?");
JOptionPane.showMessageDialog(janela, "O nome que informou foi:\n"+nome);
}
});