nergaahl
Messages postés11Date d'inscriptionmardi 9 septembre 2003StatutMembreDernière intervention16 avril 2008
-
11 juin 2007 à 14:48
amundain
Messages postés110Date d'inscriptionmercredi 28 mars 2007StatutMembreDernière intervention28 août 2012
-
11 juin 2007 à 16:12
<!-- / icon and title -->
<!-- message -->Bonjour,
J'aimerai savoir comment intégrer une JComboBox lorsque je fais un
JOptionPane.showInputDialog au lieu de rentrer manuellement ou de créer
moi même une boite de dialogue.
ou le tableau d'Object correspond aux valeurs que tu veux mettres dans ta JComboBox.
ex : String[] toto=new String[] {"1","2"};
-----------> quand tu ajoutes "toto" au constructeur en tant que Object[] selectionValues, tu obtiens une ComboBox avec "1" et "2".
A +,
amundain
Je te mets un petit code vite fait :
import javax.swing.*;
public class Main2 extends JFrame{
private String[] toto=new String[]{"1","2"};
public Main2()
{
JOptionPane.showInputDialog(this, "voilà une JCOmboBoix", "JComboBox dans un InputDialog", 2, new ImageIcon("Alert.png"), toto, "1");
}
public static void main(String[] args) {
Main2 T=new Main2();
}
}