Solved

getContentPane() and getRootPane()

Posted on 2009-06-29
1
494 Views
Last Modified: 2012-05-07
Top level containers are such as the JFrame, JPanel and so on. Now we cannot directly add a component to a swing container (top level container). We can only add components to the container ContentPane by calling the getContentPane() method. Also a RootPane cannot have children. Therefore we cannot add components to the RootPane. Instead we can add components to the ContentPane of the RootPane. A RootPane is used to manage the interior of a frame such as the ContentPane, LayeredPane, GlassPane and MenuBar. Is this why we can set a JMenuBar on a RootPane?.
0
Comment
Question by:eugene007
1 Comment
 
LVL 6

Accepted Solution

by:
jwenting earned 50 total points
Comment Utility
The RootPane contains everything else, including MenuBars etc.
The ContentPane contains window content only.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now