title: Java compile error: code too large
body: <p>So we're working on an Enrollment System and now we're stuck because of memory error during compile. </p>
  
  <p>We researched online and found that the reason is for the error message is the size of the .java file. Our EnrollmentSystem class now has 10171 lines of code.</p>
  
  <p>We designed it using the GUI builder of Netbeans. We thought of creating a separate class to contain other panels but we don't know how to get the components from another class and add it to the original class(the one that contains 10171 lines) then show it's contents on the same tab.</p>
  
  <p><a href="https://i.stack.imgur.com/VtYPg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VtYPg.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/SRwOk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SRwOk.jpg" alt="enter image description here"></a></p>
  
  <p>*What we need to accomplish is that when user clicks on a specific tabbed pane, it shows the panels from another class.</p>
  
  <p>I know it has something to do with
  object.add()
  instantiation</p>
  
  <p>We tried getComponent(nth); but really don't know how to manage classes and add components from different classes.</p>