Пример #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);
  }
Пример #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);
  }
Пример #3
0
  /**
   * Sets the layered pane for the root pane. The layered pane typically holds a content pane and an
   * optional <code>JMenuBar</code>.
   *
   * @param layered the <code>JLayeredPane</code> to use
   * @exception java.awt.IllegalComponentStateException (a runtime exception) if the layered pane
   *     parameter is <code>null</code>
   */
  public void setLayeredPane(JLayeredPane layered) {
    if (layered == null)
      throw new IllegalComponentStateException("layeredPane cannot be set to null.");
    if (layeredPane != null && layeredPane.getParent() == this) this.remove(layeredPane);
    layeredPane = layered;

    this.add(layeredPane, -1);
  }
Пример #4
0
 /**
  * Called by the constructor methods to create the default <code>layeredPane</code>. Bt default it
  * creates a new <code>JLayeredPane</code>.
  *
  * @return the default <code>layeredPane</code>
  */
 protected JLayeredPane createLayeredPane() {
   JLayeredPane p = new JLayeredPane();
   p.setName(this.getName() + ".layeredPane");
   return p;
 }