Only the BorderLayout.CENTER displays, and it fills the frame. If I comment out the red center, I get a white center (default I assume) filling the frame. I'm obviously missing something basic, but I don't see it Test1 and Test1_panel are in separate files if that matters.
Thanx - Charlie
public class Test1_panel extends JPanel {
public Test1_panel(Color c) {
setBackground(c);
}
public void setSize(int x, int y) {
setPreferredSize(new Dimension(x, y));
}
}
class Test1 {
//----------------------------------------------
// Here's the main function to get things going.
//----------------------------------------------
public static void main(String argv[]) {
Test1_frame tf = new Test1_frame("The banana boat has arrived.");
Container p = tf.getContentPane();
Test1_panel tp1 = new Test1_panel(Color.red);
Test1_panel tp2 = new Test1_panel(Color.green);
Test1_panel tp3 = new Test1_panel(Color.blue);
Test1_panel tp4 = new Test1_panel(Color.yellow);
Test1_panel tp5 = new Test1_panel(Color.black);
p.add(tp2, BorderLayout.NORTH);
p.add(tp1, BorderLayout.CENTER);
p.add(tp5, BorderLayout.WEST);
p.add(tp4, BorderLayout.SOUTH);
p.add(tp3, BorderLayout.EAST);
tf.showIt(300, 300);
}
}