Код внутри метода actionPerformed():
String str = textField.getText().trim(); if (str.isEmpty()) { JOptionPane.showMessageDialog(null, "Введите имя!"); } else { JOptionPane.showMessageDialog(null, "Привет! " + str); }
String str = textField.getText().trim(); if (str.isEmpty()) { JOptionPane.showMessageDialog(null, "Введите имя!"); } else { JOptionPane.showMessageDialog(null, "Привет! " + str); }