This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
As in AWT ,when we extends Frame,we can directly add components e.g Panel on Frame like add(p1). but why when we use Swing and Extends Jframe we cannot directly add component to Jframe,first we have to create Container c = getContentPane() and then add panel to it?
The Swing containers are a little more complex. There's a single child of a JFrame called a JRootPane. This pane contains the content pane, the menu bar (if there is one), and a layered pane and glass pane. You add your user-components to the content pane. The other panes are used for different things. For example, drawing into the glass pane will draw your component on top of everything else. There's a good swing tutorial on using JRootPane. You should look up the API docs for JRootPane and read up on it.