I would like to check on which actionEvent has occurred with 'ActionEvent e' and 'e.getSource'. Can I use a switch case for this?
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;
} }