Using applets

Hi!

I'm a bit confused regarding applets.

Why do some people only use theextends Applet on the heading and other (especially all the tutorials from the universities I know) use a simple class with a simplemain method that uses another class that extends Frame in some cases and JPanel in other case.

Are the both right?

Why can't I launch the second one?

[403 byte] By [kotokoa] at [2007-11-27 10:37:56]
# 1

I hope I'm making at least some sense here. The classes extending Applet are to be shown in a web browser, embedded on the page. A class with nothing but a main-method would traditionally be a command-line application. Extending Frame results in a stand-alone application with a visible window, a GUI. They are all correct, it just depends on what you want to create.

cyberdaemon22222a at 2007-7-28 18:51:24 > top of Java-index,Java Essentials,New To Java...
# 2

I am not sure which one you cannot launch, but if it's the one extending JPanel it is probably because it is just a class used by some other class, i.e. it is not the main entry point or the main application.

cyberdaemon22222a at 2007-7-28 18:51:24 > top of Java-index,Java Essentials,New To Java...
# 3

There is no problem in launching the program in any of the two ways. For GUI demo's you can use either of them i.e. using the Applet or Frame. Do you face some problem launching it the second way?

Brucesworda at 2007-7-28 18:51:24 > top of Java-index,Java Essentials,New To Java...
# 4

He could be running the application in the appletviewer that causes an error.

deAppela at 2007-7-28 18:51:24 > top of Java-index,Java Essentials,New To Java...