You are on page 1of 2

import javax.swing.

JOptionPane;
int opcion = JOptionPane.showConfirmDialog(null, Debes elegir uno", Decide",
JOptionPane.YES_NO_OPTION);

If (opcion == JOptionPane.YES_OPTION) { // seleccion SI }


else { // seleccion NO
}
//---------------------------------------------------------------------------------------------------------------int showInputDialog

Object meses[]={"Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio",
"Agosto","Septiembre","Octubre","Noviembre","Diciembre"};
String opcion=null;
opcion=(String) JOptionPane.showInputDialog(null,"Elija un Mes", "Fecha",
JOptionPane.QUESTION_MESSAGE, null, meses, meses[0]);
if (opcion == "Enero" ) hoy.setMes(1);

int showOptionDialog

Object menu[]={"Ver Dia","Ver Mes","Ver Ao"};


int opcion;
opcion = JOptionPane.showOptionDialog(null,"Elige una",
"Fecha",JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, menu,
menu[0]);
switch(opcion){
Case 0:
System.out.println(el dia es +
hoy.getDia();
break }
}

You might also like