[3652] in java-interest

home help back first fref pref prev next nref lref last post

Re: writing code that works for applications AND applets

daemon@ATHENA.MIT.EDU (Caskey Dickson)
Tue Nov 21 17:49:34 1995

Date: Tue, 21 Nov 1995 11:41:09 -0800
To: "James E. Kittock" <kittock@interval.com>
From: Caskey Dickson <caskey@perfectmarket.com>
Cc: java-interest@java.sun.com

At 11:49 AM 11/17/95 -0700, you wrote:
>Hi,
>
>I'm just curious what needs to be done to write a program
>that will work as both an application and an applet.
>
>I currently see two options:
>
>1. have the "main" class be a subtype of the class java.applet.Applet
>and add a "main" method that does a new and then calls init()
>and start()
>
>2. have the main functionality hidden and have two front-end
>classes, one for running the program as an applet and one for 
>running the program as an application.
>
>The latter seems like it would be more complicated, but the
>first means that all my programs will be subclasses of applet--
>is that going to be a problem in the long run?
>
>Thanks,
>--james

James,

Here's my take on it...

I would build all the components and parts of my appl(et/ication)
(appletication?) like normal and simply change the instantiation of the
final class which made use of all those classes.
One option is that your application is culminated in a subclass of frame
which implements runnable.  The applet simply creates and shows this frame,
the application does something similar.  Would this work?

-                                                                 -
-Caskey Dickson                           caskey@perfectmarket.com-
-Director of Programming                              818.542.3820-
-PerfectMarket Inc.                              (fax)818.542.3837-
-                                                                 -

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post