title: How to get the selected index of JCheckbox?
body: <p>How to get the selected index (from a number of jcheckbox added to the screen using for loop) of JCheckbox?.</p>
  
  <pre><code>// for some t values:
  checkBoxes[t] = new JCheckBox("Approve");
  checkBoxes[t].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent  e) {
          boolean selected = checkBoxes[t].isSelected();
          System.out.println("Approved"+selected);
      }
  });
  </code></pre>
  
  <p>When i click the check box, i want to get the selected check box's index.</p>