• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on JFrame  RSS feed

 
Ramkumar Vaitheki
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

Is it possible to embed an JFrame into an another JFrame. If we can, tell me the way of adding it. Looking forward your response.

Thanks,
Ram
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ramkumar Vaitheki:
... embed an JFrame into an another JFrame.


Use JInternalFrame
 
Campbell Ritchie
Sheriff
Posts: 55364
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look through the API for JFrame and find the add() method, find out what type of parameter it can take. If that is JFrame or one of its superclasses, then you can embed a JFrame inside another JFrame, yes.

But why??? It seems pointless.
 
Campbell Ritchie
Sheriff
Posts: 55364
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Maneesh, JInternalFrame is a much better idea.
 
Ramkumar Vaitheki
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default in swing, all the components are containers. JFrame is a container as well as component. I should not use JInternalFramem,needed to use JFrame alone. It gives "Illegal argument exception" while trying it.

Ram
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Is it possible to embed an JFrame into an another JFrame.

what happened when you tried it?

> I should not use JInternalFramem,needed to use JFrame alone.
> It gives "Illegal argument exception" while trying it.

JInternalFrames are (typically) added to a JDeskTopPane,
the desktopPane then being added to the JFrame
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!