Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

frames

 
sun par
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can frames be added to another container?
Thanks
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, an IllegalArgumentException will be thrown if you try to add any type of Window to a Container. You should try to write the code before asking this kind of question, you would have found the answer very quickly. The code is as simple as this:

Never forget that practicing is the key to your success.
 
sun par
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Valentin,
Thanks.
 
Johnson K Jose
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sunita,
Some more tips....
Basically a container is a component that can accommodate other components and containers.
This will provide support for building complex hierarchical GUIs.
The abstract class Container has two sub classes
1.Panel and
2.Window.
Sub class of panel is Applet and That of Window class is Frame and Dialog.
In general there are two types of containers, one can exist by it�s own and the other can not.
One can exist by its own is known as a "Top Level Window". Example Window and its sub classes (Frame and Dialog).
And for the other type Example is Frame class.
A Top Level container (Window) can not be incorporated in to other type of containers (This is the answer to your question!),
But it can contain other "non Top Level container", example a frame can contain Panel, but not in the other way!.
In that case it will throw an IllegalArgumentException (as Mr.Valentin Crettaz mentioned)
Hope this will help you
Johnson
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic