Last active
June 26, 2019 06:50
-
-
Save DavidBernalGonzalez/75ae74e4051c2306234269ad3ba3e196 to your computer and use it in GitHub Desktop.
JOptionPane4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JOptionPane; | |
public class Main { | |
public static void main(String[] args) { | |
int ventanaYesNotCancel = JOptionPane.showConfirmDialog(null, "¿Quieres salir del programa?", "Javadesde0.com", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); | |
//0=yes, 1=no, 2=cancel | |
if(ventanaYesNotCancel == 0) { | |
System.out.println("Has pulsado Yes"); | |
}else if(ventanaYesNotCancel == 1){ | |
System.out.println("Has pulsado No"); | |
}else if(ventanaYesNotCancel == 2){ | |
System.out.println("Has pulsado Cancel"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment