title: Top layer in JLayeredPane not displaying
body: <p>I'm trying to create a panel that uses a JLayeredPane to have a panel centered above another, larger panel. I can't seem to get the smaller panel to display though. Any ideas as to what I'm doing wrong?</p>
  
  <pre><code>import java.awt.Dimension;
  
  import javax.swing.BoxLayout;
  import javax.swing.JComponent;
  import javax.swing.JFrame;
  import javax.swing.JLayeredPane;
  import javax.swing.JPanel;
  
  public class MainPanel extends JPanel {
  private JLayeredPane pane;
  private AllPlayersPanel players; //Larger panel, uses circleLayout
  private GamePanel game; //Smaller panel, simple BorderLayout
  
  public MainPanel(){
      super();
      setSize(900, 900);
      setLayout(new BoxLayout(this,  BoxLayout.PAGE_AXIS));       
  
      pane = new JLayeredPane();
      pane.setPreferredSize(new Dimension(900, 900));     
  
      players = new AllPlayersPanel();
      players.setPreferredSize(players.getPreferredSize());
      players.setLocation(0,0);
      //players.setOpaque(false);
      pane.add(players, new Integer(0));
  
      game = new GamePanel();
      game.setPreferredSize(game.getPreferredSize());
      game.setLocation(385, 405);
      //game.setOpaque(false);        
      pane.add(game, new Integer(2));
  
      add(pane);
  }
  
  public static void main(String[] args) {
      JFrame frame = new JFrame();
      JComponent newPane = new MainPanel();
      newPane.setOpaque(true);
      frame.setContentPane(newPane);
      frame.pack();
      frame.setVisible(true);
  }
  
  }
  </code></pre>
  
  <p>I've tried every combination of .setOpaque() I can think of as well.</p>
  
  <p>CircleLayout can be found <a href="http://www.java2s.com/Tutorial/Java/0240__Swing/CircleLayout.htm" rel="nofollow">here</a></p>