import java.awt.*;
public class CompLay extends Frame{
public static void main(
String argv[]){
CompLay cl = new CompLay();
}
CompLay(){
Panel p = new Panel();
p.setBackground(Color.pink);
p.add(new Button("One"));
p.add(new Button("Two"));
p.add(new Button("Three"));
add("South",p);
setLayout(new FlowLayout());
setSize(300,300);
setVisible(true);
}
}
This will layout the components at the top of the frame since the Layout is set to Flow Layout.
But somewhere I read that when setting the layout after some components have been layed out, will change the layout for the future components and not for the components that are already layed, According to that rule, dont you think that the buttons should be at the bottom and any new comp after that setLayout should get FlowLayout
Can someone clarify?