1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| import java.awt.*; // plus specialement on aura besoin de java.awt.Choice
public class ComboBox {
public static void main (String [] args){
int numElement = 0;
Frame w = new Frame ("Fenetre ComboBow");
Choice maCombo = new Choice();
maCombo.addItem("France");
maCombo.addItem("Allemagne");
maCombo.addItem("Suede");
maCombo.addItem("Espagne");
w.add("Center",maCombo);
w.show();
System.out.println ("le pays choisi est: " + select(numElement));
}
public static String select( int numElement){
int numero;
String pays = maCombo.select(numero);
}
} |
Partager