Je suppose que vous avez deux jComboBox
:
jComboBox1 and jComboBox2
maintenant je magasin sélectionné deux valeurs de jComboBoxes
comme String
et fait l'événement d'action dans votre jButton
comme:
String str1=jComboBox1.getSelectedItem().toString();
String str2=jComboBox2.getSelectedItem().toString();
searchButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
searchValue(sre1,str2);
}
});
public void searchValue(String str1, String str2){
//your code to get connection and so on
try{
/**
*You can make your select query like:
*SELECT * FROM TABLE WHERE someField1='"+str1+"' and someField2='"+str2+"'
*/
}catch(Exception e){
e.printStackTrace();
}
}
Pouvez-vous élaborer un peu plus? – RamonBoza
Postez votre code, sinon nous ne pouvons pas vous aider. Qu'est-ce que ça veut dire que ça ne marche pas? –