File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes A (silly) Applet question.............. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A (silly) Applet question.............." Watch "A (silly) Applet question.............." New topic

A (silly) Applet question..............

Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
Ok folks, i'm back.
I used to be sort of semi-regular on here, but close bereavement seriously threw me off course, for a fair time. :roll:
Still adjusting, as well.
But anyway, i've started back on my java, and have a query on applets. It seems i've fallen at the first hurdle...................
OK, i says in Sams' "learn java in 21 days" that "all applets are subclasses of either the JApplet class in the javax.swing package, or its superclass, the Applet class, in the java.applet package. The JApplet class is a better choice because it supports Swing."

What I don't get is, if the Applet class is the superclass, shouldn't this be the better choice, as being the superclass, it is all encompassing. Or am i visualising this the wrong way. And that the Swing is created lower down in a subclass from the Applet class, and is therefore not 'seen' by this superclass.
I have just asked the dumbest question of the year, probably, on the most basic concept of OO programming. But folks, believe me, for me, it's been a while!

John Bonham was stronger, but Keith Moon was faster.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

More specialized classes -- subclasses -- are the ones that add additional features.
Now actually, I'd take strong exception to the statement you're quoting, as "better" is relative to what it is you need to do. If you want to write an applet that runs only in Sun's Java plug-in, then you can go with JApplet. If you want to run in the Microsoft VM, or the old VM that comes with Netscape, then you more or less need to stick with Applet.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: A (silly) Applet question..............
It's not a secret anymore!