< prev index next >

src/java.desktop/share/classes/javax/swing/JRootPane.java

Print this page




 524     }
 525 
 526     /**
 527      * Called by the constructor methods to create the default
 528      * <code>layoutManager</code>.
 529      * @return the default <code>layoutManager</code>.
 530      */
 531     protected LayoutManager createRootLayout() {
 532         return new RootLayout();
 533     }
 534 
 535     /**
 536      * Adds or changes the menu bar used in the layered pane.
 537      * @param menu the <code>JMenuBar</code> to add
 538      */
 539     public void setJMenuBar(JMenuBar menu) {
 540         if(menuBar != null && menuBar.getParent() == layeredPane)
 541             layeredPane.remove(menuBar);
 542         menuBar = menu;
 543 
 544         if(menuBar != null)

 545             layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
 546     }

 547 
 548     /**
 549      * Specifies the menu bar value.
 550      * @deprecated As of Swing version 1.0.3
 551      *  replaced by <code>setJMenuBar(JMenuBar menu)</code>.
 552      * @param menu the <code>JMenuBar</code> to add.
 553      */
 554     @Deprecated
 555     public void setMenuBar(JMenuBar menu){
 556         if(menuBar != null && menuBar.getParent() == layeredPane)
 557             layeredPane.remove(menuBar);
 558         menuBar = menu;
 559 
 560         if(menuBar != null)
 561             layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
 562     }
 563 
 564     /**
 565      * Returns the menu bar from the layered pane.
 566      * @return the <code>JMenuBar</code> used in the pane




 524     }
 525 
 526     /**
 527      * Called by the constructor methods to create the default
 528      * <code>layoutManager</code>.
 529      * @return the default <code>layoutManager</code>.
 530      */
 531     protected LayoutManager createRootLayout() {
 532         return new RootLayout();
 533     }
 534 
 535     /**
 536      * Adds or changes the menu bar used in the layered pane.
 537      * @param menu the <code>JMenuBar</code> to add
 538      */
 539     public void setJMenuBar(JMenuBar menu) {
 540         if(menuBar != null && menuBar.getParent() == layeredPane)
 541             layeredPane.remove(menuBar);
 542         menuBar = menu;
 543 
 544         if(menuBar != null) {
 545             menuBar.updateUI();
 546             layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
 547         }
 548     }
 549 
 550     /**
 551      * Specifies the menu bar value.
 552      * @deprecated As of Swing version 1.0.3
 553      *  replaced by <code>setJMenuBar(JMenuBar menu)</code>.
 554      * @param menu the <code>JMenuBar</code> to add.
 555      */
 556     @Deprecated
 557     public void setMenuBar(JMenuBar menu){
 558         if(menuBar != null && menuBar.getParent() == layeredPane)
 559             layeredPane.remove(menuBar);
 560         menuBar = menu;
 561 
 562         if(menuBar != null)
 563             layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
 564     }
 565 
 566     /**
 567      * Returns the menu bar from the layered pane.
 568      * @return the <code>JMenuBar</code> used in the pane


< prev index next >