Adding JPanels in series?
Hi, Im trying to add 2 Panels to a Frame. When I add the First one alone it appears in the frame (Both Panels just have a single button in them to test that its Accualy there), but when I goto add another Panel it seems as if it overlapped the first Panel or somthing because now I can only see the new Button. I thought that if you add 2 Panels to a frame that they are added side by side in series.
publicvoid makeFrame()
{
JFrame myFrame =new JFrame();
frame = myFrame;
frame.setSize(500,500);
frame.setTitle("Nasa Program");
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
publicvoid addPanels()
{
JPanel panel =new JPanel();
panel.add(new JButton("dfgdfghjkghjkghjkghjkgjkgjk"));
JPanel panel2 =new JPanel();
panel2.add(new JButton("new"));
frame.add(panel);
frame.add(panel2);
}
This is the code block.
So when I run it it just shows one button that says "new" and it appears in the top middle of the frame.
Any Ideas how to have both frames appear right?

