Panel

Using Panels
As you now realize, using Java's Layout Managers doesn't always produce desireable results. Using null layout is not cross platform. So, what can we do to get the best possible layout without resorting to null layout? Well, one answer is to use panels.

A panel can contain a panel which contains other panels or components. A panel can be set to use any layout manager. So, through a combination of using panels and layout managers, we should be able to achieve any layout we can imagine... maybe.

Below is an example applet that uses a bunch of panels. What you need to do is trace through the code and see where components are added to panels. Try to see how the applet layout which you see on the page is controlled by the commands in the code. You don't have to worry about anything but Panel stuff for this assignment. So, you can ignore some of the other stuff. Just try to see how all the stuff gets placed on the page.


Scoreboard Applet:


Further Reading:
Panels and Layout

Assignment:
Create an applet that looks like the one down below using panels and BorderLayout. Hint: Create a panel and place all the inner most stuff in it and then place it inside another panel and get the next layer of stuff in it and finally place this panel in the center of an applet and then add the outside layer.