Ejemplo n.º 1
0
  /**
   * Specifies the menu bar value.
   *
   * @deprecated As of Swing version 1.0.3 replaced by <code>setJMenuBar(JMenuBar menu)</code>.
   * @param menu the <code>JMenuBar</code> to add.
   */
  @Deprecated
  public void setMenuBar(JMenuBar menu) {
    if (menuBar != null && menuBar.getParent() == layeredPane) layeredPane.remove(menuBar);
    menuBar = menu;

    if (menuBar != null) layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
  }
Ejemplo n.º 2
0
  /**
   * Sets the content pane -- the container that holds the components parented by the root pane.
   *
   * <p>Swing's painting architecture requires an opaque <code>JComponent</code> in the containment
   * hierarchy. This is typically provided by the content pane. If you replace the content pane it
   * is recommended you replace it with an opaque <code>JComponent</code>.
   *
   * @param content the <code>Container</code> to use for component-contents
   * @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane
   *     parameter is <code>null</code>
   */
  public void setContentPane(Container content) {
    if (content == null)
      throw new IllegalComponentStateException("contentPane cannot be set to null.");
    if (contentPane != null && contentPane.getParent() == layeredPane)
      layeredPane.remove(contentPane);
    contentPane = content;

    layeredPane.add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
  }