Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

BEGINNER-URGENT

 
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
 
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
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • 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 Spring Java
  • 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 Spring Java
  • 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
 
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 Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry... left off the first line...
 
    Bookmark Topic Watch Topic
  • New Topic