Most of these are event sources meaning the Swing components.
All the components are capable of nesting. You can stick anything to anything.
4 steps to make a gui
1) make a frame
2) make a button
3) add the button to frame
Layout Manager, is a Java Object associated with a particular component. Each Component will have its Layout Manager.Layout Manager is applicable to components that can hold other components. for example button will not have a layout manager because it does not hold any components.
JPanel panela = new JPanel ();
JPanel panelb = new JPanel ();
panelb.add(new JButton(“button 1”));
panelb.add(new JButton(“button 2”));
panelb.add(new JButton(“button 3)));
border layout is the default manager for frame, it has five regions and it is fixed. one component per region.
flow layout is the default manager for panel, it works like a word processor . it arranges all the components to the size
box layout is quite similar to flow layout with additional features like you can have a component return key and force a component to start a new line
we can turn off the layout manager by saying setLayout(null) and then its up to you
to hard code the exact screen location and dimension of the component.
next page 447
More in next part.
Head First Java 2nd Edition