• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BEGINNER-URGENT

 
jyothi abraham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:MAD:
MY QUESTION IS IF I CAN ADD PANEL TO AN APPLET ,WHY CAN'T I ADD
A WINDOW TO AN APPLET.ANYBODY OUT THERE TO EXPLAIN ALL THESE
WINDOW,FRAME,PANELS OF GRAPHICS MAYA?
THANX,JYOTHI
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add a panel to an Applet. you can add a panel to that panel and so on. Since Applet is a panel your allowed to do that. I know that you can add an window to an applet or an applet to a window. I'm not 100% sure how to explain this so I'm leaving it to another rancher.
// Mathias
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a few top level containers that you can't add() to any another... these are Frames, Dialogs, and Windows ( and any classes that inherit from these, like JDialog, JFrame, JOptionPane, etc. )...

That doesn't mean you can't display a Frame, Window, etc. by using an applet to launch it... Here's some short code to show you how to display a window via an applet :



-Nate
 
jyothi abraham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for you people encouragement.From what i understand
can i say appletviewer is a type of frame because there is
no framelike thing at the window or sir,can you explain me
in that level,
thank you,
JYOTHI ABRAHAM
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the appletviewer program launches your applet inside a frame... you could do getParent() until you couldn't get any higher and then have a reference to the appletviewer frame.

In a browser, you can't do this because the top frame ( the browser ) is a native frame and not a Java frame ( unless the browser was written in Java ).

Applet extends Panel, which is why it can be added to any other container... a Frame, another Panel, another Applet even.

You can add() an Applet to a Frame, but you can't add() a Frame to an Applet...

-Nate
 
jyothi abraham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your good programming and great explanation.
So Can I say that basis of classification of container into
panel and windows are addability to other container?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nathan
 
Thomas Whalen
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your code doesn't work....when compiling the code the error is pointing to the inheritance from the Applet...is the Applet class not in the *.awt.* or *.awt.event.* libraries?
thanks,
thomas
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry... left off the first line...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic