用两个and或or,有4钟组合情况:
a and b and c
a and b or c
a or b and c
a or b or c
可以用一个switch语句分别处理这4总情况.
例如: byte condition1 = myJComboBox1.getSelectedIndex()//从JComboBox1得到情况一
byte condition2 = myJComboBox2.getSelectedIndex()//从JComboBox1得到情况一
byte selectedCondition = condition1*10+condition2;//用00,01,10,11来标识各个情况.switch(selectedCondition){
case 0:...//分别处理}
a and b and c
a and b or c
a or b and c
a or b or c
可以用一个switch语句分别处理这4总情况.
例如: byte condition1 = myJComboBox1.getSelectedIndex()//从JComboBox1得到情况一
byte condition2 = myJComboBox2.getSelectedIndex()//从JComboBox1得到情况一
byte selectedCondition = condition1*10+condition2;//用00,01,10,11来标识各个情况.switch(selectedCondition){
case 0:...//分别处理}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货