• Post Reply Bookmark Topic Watch Topic
  • New Topic

quick qu?  RSS feed

 
zack chancery
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you add an applet to a JPanel?
regards,
z
 
Joe Ess
Bartender
Posts: 9436
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the documentation for java.applet.Applet, you will see that it extends Panel, which in turn extends Container and Component. Component is the root class for every GUI class in Java.
Then look at javax.swing.JPanel and you will see that it extends JComponent and Container. Container has an add method which takes an argument of type Component, so you can add an Applet to a JPanel.
 
zack chancery
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cool i should have known that!
thanks,
z
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!