Is there a limit to the number of windows within windows you can have? I
want to have a number of similar frames (each containing a graphics area and
a text area) laid out in a container, which is in turn housed in a larger
window, that has a menu bar, and which also house a separate window. I
realise that I can have a JFrame as the large outer window, and as many
JPanels as I like within that, but can a JPanel within a JFrame contain
futher discreet windows (such as other JPanels)which have their own
components, such as the frame mentioned above?
Many thanks,
Martin
JPanels can certainly nest quite deep. This is in fact a common
practice used by designers to make complex layouts using just the
simple ones (Border-, Grid-, Flow-) plus some spit and polish.
I don't know what the theoretical limit on panel nesting is, though.
Keep in mind that when you say "window", some may interpret that as
java.awt.Window, which is a generic top-level beast, as opposed to
java.awt.Container, which is a generic Component which may contain
sub-Components. (JPanel is a subclass of Container. JFrame, JDialog,
and other are subclasses of Window.) I'm pretty sure you can't put a
Window inside any Container, whereas you can put a Container inside
both Windows and other Containers.
--
Paul Brinkley
ga...@clark.net
> I don't know what the theoretical limit on panel nesting is, though.
There isn't any theoretical limit. Each component contains a pointer
to its parents, and each container (a type of component) contains a
list of pointers to its children. About the only thing that might
limit nesting is the fact that much of the layoutting and painting
functionality involves recursively calling the function on the
children. So eventually, stack overflow will intervene. I suspect
that all limits of understandability will have been passed long
before, however.
--
James Kanze mailto:ka...@gabi-soft.de
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
Ziegelhüttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627
Okay, thanks!
Stuart