title: What is the best way to determine what JRadioButton is selected?
body: <p>Currently I'm getting the selected button in this way, but I don't if this is the right/best method. MAybe there something more easy or object oriented than this.</p>
  
  <pre><code>private int getFilterType(JRadioButton... buttons) {
      for (int i = 0, n = buttons.length; i &lt; n; i++) {
          if (buttons[i].isSelected()) {
              return i + 1;
          }
      }
      return buttons.length + 1;
  }
  </code></pre>