hey i been making a JFrame window with a JMenuBar a JList and some other stuff but i can never seem to remember or figure out
what order they have to be layed can anyone tell me which windows or panels or what not can parent other windows
... I am sorry if what I ask don't make too much sense but I am trying my best to explain.

I need hieracy (excuse the spelling :( ) of what windows can be added on top of others.

like.

JFrame, JPanel, JMenuBar.

please if you can understand what i have said because I am not sure it makes sense the any help will be great.
thanks.

Or are you looking for an explanation as to what can be added to what (Components are added to Containers - look at the inheritance of the classes you use)

Quote:

no ones replying ? is it a stupid question anything would help

Please don't expect unpaid volunteers to be online waiting to answer each and every thread 24/7

June 9th, 2012, 11:02 AM

.Swing

Re: About layering JFrames JPanels and the whole deal with that?

yes kind of so i was wondering if there was a specific order containers can be placed onto eachother. so like a jpanel cannot be placed on another jpanel. or is this still a stupid question?

June 9th, 2012, 12:12 PM

copeg

Re: About layering JFrames JPanels and the whole deal with that?

My advice would be to try it and see...theory is one things, but getting it to work is another. Here's the theory:

Take a look at the inheritance hierarchy of JPanelJPanel (Java Platform SE 6)
Component->Container->JComponent->JPanel
Now take a look at the add method in Container (which is what one uses to add things to a JPanel) - it is defined as accepting a Component ...in other words you can add anything that is a Component to a Container. JPanel extends both, so yes you can add one JPanel to another, just as you can add other JComponents to a JPanel. This nesting is powerful, as different JPanel's can have different LayoutManagers, allowing you a huge amount of flexibility in laying out a user interface.