• This is default featured slide 1 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 2 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 3 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 4 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

  • This is default featured slide 5 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by NewBloggerThemes.com.

Mostrando entradas con la etiqueta swing. Mostrar todas las entradas
Mostrando entradas con la etiqueta swing. Mostrar todas las entradas

Trabajando con Joptionpane

Cuando no hemos estado descontentos con las minimas opciones del Joptionpane que solo nos da si ,no y cancel.
Pues pasando un parametro que es un objeto podremos redefinir las opciones a elegir.
Bueno veremos esto en este ejemplo.

package seleccionadordearchivos;

import javax.swing.JOptionPane;

/**
*
* @author JONATHAN
*/
public class Joption {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Object[] opciones={"Si quiero", "No quiero", "Quiza¡",
"Me da igual","??"};
int n=JOptionPane.showOptionDialog(null
,"Elija una de las cuatro","Titulo"
,JOptionPane.DEFAULT_OPTION
,JOptionPane.WARNING_MESSAGE
,null
,opciones,opciones[0]);
System.out.println("La opcion elegida es la "+n);
System.exit(0);
}
}

Aqui se imprime en consola el indice con lo cual podran saber que opcion se elegio
Share:

Visitantes

Flag Counter

Popular Posts

Etiquetas

Recent Posts