title: How to access JFrame components from a JPanel class?
body: <p>I'm working on a GUI assignment and I encountered a problem that I cannot figure out. I have a JFrame with multiple JPanels, one of those JPanels contains a CardLayout with multiple JPanels. Since we are more people working on the project we decided to make a separate class (that extends JPanel) for each panel that's gonna be inside the CardLayout. </p>
  
  <p><strong>The problem is accessing components of the JFrame from the JPanel classes.</strong></p>
  
  <p>To give you an example, I have a JLabel somewhere in the JFrame that serves as a status bar and I want to change the text of the status bar when a button is pressed on the SaleMain panel (a class SaleMain that extends JPanel, contained in the CardLayout). </p>
  
  <p>Another example, inside another panel EditCustomer (also a JPanel class, included in the CardLayout), I'd like to have a button with an action listener that will change the current panel (the one containing the button) to a different panel from the CardLayout.</p>
  
  <p>Hope I made it as clear as possible, thank you guys in advance for helping me :)</p>