title: Java - Actionlistener: Get components from parent
body: <p>The only way I found so far to get other components' info when an actionevent is activated is by doing the following:</p>
  
  <pre><code>((Swing Component)ActionEvent.getSource()).getParent().getComponent(---).method();
  </code></pre>
  
  <p>and while it work it's not that practical or readable, not to mention would most likely stop working properly if I moved around the components in the parent component.</p>
  
  <p>So what is the best way to go about this? Should I even use an actionlistener to begin with or are there better classes/design for this purpose?</p>