0
Is it possible to make Joptionpane dynamic ? I’m having difficulty registering new entries in the countrys array[].
I’m using Java 1.8 sdk
Code
import javax.swing.JOptionPane;
import javax.swing.ImageIcon;
public class Javaapp {
public static void main(String[] args) {
ImageIcon icon = new ImageIcon("flag.png");
String countrys[]={"India","America","Australia"};// tornar dinamico
String name=(String)JOptionPane.showInputDialog(null,
"Country name",
"Country Confirmation",
JOptionPane.PLAIN_MESSAGE,
icon,
countrys,
countrys[0]);
System.out.println(name);
}
}
Codigo Pais
public class Countrys {
private String nomepais;
public String getNomepais() {
return nomepais;
}
public void setNomepais(String nomepais) {
this.nomepais = nomepais;
}
public Countrys(){
}
}