Hello, there:
I appreciate that so many friends helped me. Thanks you guys.
I think i should have no problem with awt staff, but i got this tricky question that i don't know what's going on there.
Say :
import java.awt.*;
public class Q188 extends Frame
{
Button bnorth = new Button("North");
Button bsouth = new Button("South");
Button beast = new Button("East");
Button bwest = new Button("West");
Button bcenter = new Button("Center");
public Q188( )
{
setLayout(new FlowLayout( )); // Line F
add(bnorth);
add(bsouth);
add(bwest);
add(beast);
add(bcenter);
setLayout(new BorderLayout( )); // Line B
validate( );
setSize(200,200);
setVisible(true);
}
public static void main(String a[ ])
{
Q188 q = new Q188( );
}
}
As far as i know, this should come out only one button with label "Center" and occupies the whole frame.
However, it is not. The result is : no component is visible, it is empty ! I don't know why ?
I try to comment the Line F and Line B, it comes out what i expect, one button labeled "Center".
I comment Line B, of course, five buttons appear.
I comment Line F, it is empty, no button is visible.
It seems that there is a difference between the default BorderLayout and explicit setLayout with BorderLayout.
I am confused with this part. Can someone explain that ?
Thanks in advance. I will keep thinking.
Honggui