This question already has an answer here:
Is there some way to improve this if statement i have
if((monthBox.getSelectedIndex()==0)||(monthBox.getSelectedIndex()==2)||(monthBox.getSelectedIndex()==4)||(monthBox.getSelectedIndex()==6)||(monthBox.getSelectedIndex()==7)||(monthBox.getSelectedIndex()==9)||(monthBox.getSelectedIndex()==11)){
for(int i=0;i<=31;i++){
dayBox.addItem(i);
}
}
I have a bunch of months which the user selects one from and then with that month it populates another combobox with the amount of days that month has.
Is there some way to do something like this
if(monthBox.getSelectedIndex()==1,2,...){
//code here
}
Aucun commentaire:
Enregistrer un commentaire