KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > p2p > peerconfiguration > DaysCheckCangeListener


1 package org.objectweb.proactive.p2p.peerconfiguration;
2 import javax.swing.*;
3 import javax.swing.event.*;
4
5
6 public class DaysCheckCangeListener implements ChangeListener {
7
8        protected JCheckBox[] cbx = null;
9        protected boolean selected = false;
10
11        public DaysCheckCangeListener(JCheckBox[] cbx) {
12               this.cbx = cbx;
13        }
14
15        public void stateChanged(ChangeEvent e) {
16               if (cbx!=null) {
17                   if (!selected) {
18                      for (int i=0; i<cbx.length; i++) {
19                          if (!cbx[i].isSelected()) cbx[i].setSelected(true);
20                      }
21                      selected=true;
22                   } else {
23                      selected=false;
24                   }
25               }
26        }
27
28 }
Popular Tags