-----------------------------------------------
one general question: what do methods validate() and pack() do ? even if they are not used i don't see any change in the GUI.
-----------------------------------------------
in this question, any unallotted space is taken or given to CENTER. is that correct ?
now question is as follows:
A frame uses BorderLayout Management and has components added to all the regions. On resizing the Frame some space becomes available. The space is alloted to the regions, in which Order of preference?
North , South, West, East and then Center.
North , West, South, Center and then Center.
Center, East, West, South and then North.
West, Center, South, North and then East.
------------------------------------------------
in this question the layout is set to be Flow and then components are added. and then layout is changed to Border. but BorderLayout needs that components be specifically allotted to their 5 respective positions, which if not, nothing is visible. Hence nothing is visible. is the reasoning correct ?
import java.awt.*;
public class TestFrame 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 TestFrame()
{
setLayout(new FlowLayout());
add(bNorth);
add(bSouth);
add(bWest);
add(bEast);
add(bCenter);
setLayout(new BorderLayout());
validate();
setSize(300,300);
setVisible(true);
}
public static void main(
String args[])
{
TestFrame tf = new TestFrame();
}
}
------------------------------------------------
[ February 02, 2002: Message edited by: mark stone ]