Nesting Panels

Sometimes what's needed is multiple instances of the same LayoutManager. For instance, consider the calculator applet again.

Calculator keypad

On the one hand this looks like it should be simple to implement in Java. After all it's just eighteen buttons and a TextField. On the other hand although most of the keys are the same size, two of the keys and the TextField are oversized. You could almost use a GridLayout, but not quite. Panels are one way to solve this problem.

Previous | Next | Top | Cafe au Lait

Copyright 1997, 1998, 2006 Elliotte Rusty Harold
Last Modified April 18, 2006