This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • 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: 9414
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!