contentPane.setBounds(contentPaneBounds);
getContentPane().setBounds(contentPaneBounds);
    public void layoutContainer(Container c)    {      if (glassPaneBounds == null || layeredPaneBounds == null          || contentPaneBounds == null || menuBarBounds == null)        {          Insets i = getInsets();          int containerWidth = c.getBounds().width - i.left - i.right;          int containerHeight = c.getBounds().height - i.top - i.bottom;      // 1. the glassPane fills entire viewable region (bounds - insets).      // 2. the layeredPane filles entire viewable region.      // 3. the menuBar is positioned at the upper edge of layeredPane.      // 4. the contentPane fills viewable region minus menuBar, if present.                // +-------------------------------+          // |  JLayeredPane                 |          // |  +--------------------------+ |          // |  | menuBar                  | |          // |  +--------------------------+ |          // |  +--------------------------+ |          // |  |contentPane               | |          // |  |                          | |          // |  |                          | |          // |  |                          | |          // |  +--------------------------+ |          // +-------------------------------+          if (menuBar != null)            {              Dimension menuBarSize = menuBar.getPreferredSize();              if (menuBarSize.height > containerHeight)                menuBarSize.height = containerHeight;              menuBarBounds = new Rectangle(0, 0, containerWidth,                                            menuBarSize.height);              contentPaneBounds = new Rectangle(0, menuBarSize.height,                                                containerWidth,                                         containerHeight - menuBarSize.height);            }          else            contentPaneBounds = new Rectangle(0, 0, containerWidth,                                              containerHeight);                        glassPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);          layeredPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);        }      glassPane.setBounds(glassPaneBounds);      layeredPane.setBounds(layeredPaneBounds);      if (menuBar != null)        menuBar.setBounds(menuBarBounds);      contentPane.setBounds(contentPaneBounds);    }