Created
May 18, 2019 21:37
-
-
Save DavidBernalGonzalez/2465a41e9233caf032b5b71b023521f0 to your computer and use it in GitHub Desktop.
JOptionPane5
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) { | |
String[] botones = {"Boton A", "Boton B", "Boton C", "Boton D"}; | |
int ventana = JOptionPane.showOptionDialog(null, | |
"Pulsa un boton:", | |
"Javadesde0.com", | |
JOptionPane.DEFAULT_OPTION, | |
JOptionPane.QUESTION_MESSAGE, null, | |
botones, botones[0]); | |
if(ventana == 0) {System.out.println("Opcion A");} | |
else if(ventana == 1) {System.out.println("Boton B");} | |
else if(ventana == 2) {System.out.println("Boton C");} | |
else if(ventana == 3) {System.out.println("Boton D");} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment