title: CardLayout - How to use previous() and next() using NetBeans GUI Builder?
body: <p>Here is what I tried:</p>
  
  <p>Dragged some JPanels onto a JFrame (using NetBeans inspector window).</p>
  
  <p>In JFrame constructor, made all JPanels invisible using <code>.setVisible(false)</code>, except the one I want to show first.</p>
  
  <p>It works and I can easily go from one to another by using some buttons with actionPerformed and adding <code>.setVisible(false)</code> to the current card and <code>.setVisible(true)</code> to the one I want to see.</p>
  
  <p>What I wanted to do now is to use CardLayout <code>previous()</code> and <code>next()</code>, similar to a browser's back/forward. I also would like to reach to a panel from different places, i.e., two panels can link to the same one, so previous panel wouldn't always be the same.</p>
  
  <p>I tried using the following code in an actionPerformed inside JFrame class:</p>
  
  <pre><code>CardLayout cardLayout = (CardLayout) this.getLayout();
  cardLayout.previous(this);
  </code></pre>
  
  <p>However, it doesn't work. What am I missing? Is this supposed to do what I'm looking for?</p>