title: Java Swing architecture problem?
body: <p>Till now, I have developed simple swing applications so there was no need to break the GUI code into diff. classes but as this application is going to be very large, I decided to break the code into diff. classes so as to make the code more manageable.</p>
  
  <p>But before proceeding, I have some doubts in my mind which are as follows:</p>
  
  <p><b>Brief description of GUI</b></p>
  
  <p>It will have a main JFrame (MainFrame). On that a JPanel(MainJPanel) is set whose layout is to be CardLayout. It will contain 25 cards (each card is in the form of JPanel which contains its own swing components).</p>
  
  <p>Q1. I have decided to make 25 classes (each for one JPanel card). Is it correct approach?</p>
  
  <p>Q2. If the above answer is correct, then how can I write code of xxxxActionPerformed() methods of buttons which are on those cards (25 cards) as these methods need access to the object of MainJPanel</p>
  
  <p>e.g.</p>
  
  <pre><code>public void buttonActionPerformed(ActionEvent evt) {
      java.awt.CardLayout c = (java.awt.CardLayout) mainJPanel.getLayout();
      c.show(mainJPanel, "card1");  // card1 is this card
      mainJPanel.updateUI();
  }
  </code></pre>
  
  <p>I googled for swing examples but almost all of them shows the use of diff. swing components. Can you also please suggest me a link that shows some swing examples that contain GUI codes in diff. classes.</p>