problème avec test JComboBox
bonsoir
j'ai deux composants JtextField et JComBobox et je voulais tester le continu des composants le problème avec JComboBox (le teste ne marche pas )
voila déclaration
Code:
1 2 3 4 5 6 7 8 9 10
|
private JLabel nombre =new JLabel ("N-fois :");
String[] data = {"1","2"};
private JComboBox choix = new JComboBox (data);
choix.setBounds (310, 110,50,20);
choix.setSelectedIndex(-1);
choix.setBackground(Color.WHITE);
choix.addActionListener(this);
pan.add(choix); |
problème avec cette partie
Code:
1 2 3 4 5 6 7 8
|
if (tcode.getText().length()<1||choix.getSelectedItem().toString().equals(" ")==true)
JOptionPane ddd = new JOptionPane();
ddd.showMessageDialog(pan,"Un ou plusieurs n'a pas été rempli",
"Erreur de frappe",JOptionPane.INFORMATION_MESSAGE) |
cette partie ne marche pas choix.getSelectedItem().toString().equals(" ")==true
merci de bien vouloir m'aider