<<< Adding a menu bar to JFrame     Index     Classes in the Component hierarchy >>>

8. The Root Pane


  • Available in Java 5 or later

    • JFrame.getContentPane() method

    • JFrame.add() method -- adds Component directly to JFrame without explicitly calling getContentPane()

    • JFrame.remove() method

    • JFrame.setLayout() method

  • Other JFrame methods must use getContentPane(). For example, setBackground()

<<< Adding a menu bar to JFrame     Index     Classes in the Component hierarchy >>>