title: Java, Large GUI classes, with many ActionListeners; best way to organize the listeners?
body: <p>I've been developing java programs for 1½ year. I'm currently working on a summer project, that involves quite a big Graphical User Interface.</p>
  
  <p>My GUI consists of several tabbed panes. Each pane has its own class. Each pane has SEVERAL jButtons. </p>
  
  <p>Now, I've come to a point, where there's so many anonymous inner classes (for ActionListeners) in my tabbed-pane classes, that I am certain there must be a better way; if not for efficiency, then for maintainability - it's becoming quite a mess.</p>
  
  <p>My question is this: Is there a better to organize listeners, when you have a lot of them in each class? I've thought about clustering the listeners in relevant classes - like the following sample code:</p>
  
  <pre><code>public class SomeListeners implements ActionListener{
  
      @Override
      public void actionPerformed(ActionEvent e){
          String command = e.getActionCommand();
          switch(command){
              case "This button":
                  doThis();
                  break;
              case "That button":
                  doThat();
                  break;                          
          }
      }     
  }
  </code></pre>
  
  <p>Or might there be an even better way?</p>
  
  <p>Thanks in advance :)</p>