如果多次點(diǎn)擊復(fù)選框,下面是解決反案。
如:
程序的一小部分,JCheckBox的監(jiān)聽處。
cb1.addActionListener(new ActionListener() {
?? ??? ??? ?int i = 0;
?? ??? ??? ?public void actionPerformed(ActionEvent e) {
?? ??? ??? ??? ?i++;
?? ??? ??? ??? ?a = 0;
?? ??? ??? ??? ?if(cb1.isSelected()) {
?? ??? ??? ??? ??? ??? ?if(i%2!=0) {
?? ??? ??? ??? ??? ??? ??? ?a = (Integer)context.list.get(0);
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?});