Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. public class CaixasDeDialogo {
  3. public static void main(String[] args) {
  4. String nome = null;
  5. int resposta;
  6. nome = JOptionPane.showInputDialog("Qual é o seu nome?");
  7. resposta = JOptionPane.showConfirmDialog(null, "O seu nome é " + nome + "?");
  8. if (resposta == JOptionPane.YES_OPTION) {
  9. // verifica se o usuário clicou no botão YES
  10. JOptionPane.showMessageDialog(null, "Seu nome é " + nome);
  11. } else {
  12. JOptionPane.showMessageDialog(null, "Seu nome não é " + nome);
  13. }
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement