Jelle is right. That means that if you just call add without any constraints, the component will be put in the center (as if BorderLayout.CENTER was used). However, BorderLayout only supports one component at each location. You'll need to add the components with explicit constraints, like BorderLayout.NORTH for the first and BorderLayout.CENTER for the second.
veena joshi wrote:y we need to add Contentpane()??
1) Please
UseRealWords: "why", not "y".
2) That was necessary in
Java 1.4 and before. Since Java 5.0 you can simply add to the JFrame; it delegates the calls to add, remove, removeAll and setLayout to its content pane.