title: Can I use switch - case, in actionPerformed method in Java
body: <p>I would like to check on which actionEvent has occurred with <code>ActionEvent e</code> and <code>e.getSource()</code>. Can I use a switch case for this? </p>
  
  <pre><code>public void actionPerformed(ActionEvent e){
      switch(e.getSource()){
          case radius:
              double r = validate(radius.getText());
              break;
          case height:
              double h = validate(height.getText());
              break;
          case out:
              out.setText(String.valueOf(h*r));
              break;
      }
  }
  </code></pre>