title: How do you change an IDE-Created JPanel to a Custom-Created JPanel?
body: <p>I want to change a specific JPanel inside my UI.</p>
  <pre><code>public Tester() {
      this.setSize(800,800);
      this.setContentPane(mainPanel); // A created panel using Intellij IDE
      otherPanel = new MyPanel(); // A custom created panel without the use of Intellij
      changePanelButton.addActionListener(e -&gt; {
          changePanel = otherPanel // Not Working
      });
  }
  </code></pre>
  <p>I can't use the setContentPane from my JFrame since it will change all of the frame's contents, not just the panel I want to change.</p>