Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

frame in applet :-(  RSS feed

 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody!
* Can an applet in java contain Frame (in AWT)?
-- If no then only applications can use Frame?
-- But we may create a panel and insert or add the
newly created frame in the panel.Right?
* Then comes the question whether a panel can contain a frame?
I think both the answer should be true.
Shoot your opinions!

------------------
azaman
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ummm... I don't have to give you my opinion because both answers are false...

If you actually try to code a panel or an applet containing a frame you will get a runtime IllegalArgumentException of "adding a window to a container".

An applet can launch a frame, but the applet itself does not contain the frame, it simply creates it and calls the frames setVisible method to display the frame...

-Nate
 
Rafiqul Islam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nathan. Just a little more.
* A panel cannot contain a window.Right?
* Another fact is that applet is one kind of panel,
not a window. Right?
------------------
Rafiq
MSS,National University
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right, a panel cannot contain a window( other than JInternalFrame... that is a special case... it extends JComponent instead of JWindow... so it just looks like a window, it really isn't a window though... ), because a Window, Frame, or Dialog is a top-level container... they can hold things, but nothing can hold them.

Applet actually extends Panel, so Applet is really just a special type of Panel.

-Nate
 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnx Nathan,
Actually I am the above Rafiq(not Rafiq but Ashik uzzaman) and the rafiq is one of my student. Their happened a technical mistake. Anyway nice explanation and it's now clear!

------------------
azaman
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!