Forums Register Login

applet and application

+Pie Number of slices to send: Send
is it possible applet and application both can retain in a single code ?
in fact when i need applet i will use applet and when i need application i will use application . can they stay both in a sigle code ?

how do i invoke them if both of them exists ?

thankig you
+Pie Number of slices to send: Send
The only real difference between an Applet and an application is the environment they run in. An Applet runs in a "sandboxed" environment in a browser, an application runs in a JVM with no such restrictions. If your Applet and application have common functionality it makes sens to create this in a set of shared classes so they can be invoked from either.
+Pie Number of slices to send: Send
>it makes sens to create this in a set of shared classes so they can be invoked from either.

set of shared classes ?
+Pie Number of slices to send: Send
Typically, when I create GUI applications, I create one class that extends JFrame and another that extends JPanel. The frame class has minimal logic; it adds the panel to its content pane and creates a menu (if I want one). The JPanel class on the other hand has most of the logic to create the GUI controls (buttons, text fields, labels, etc.). This allows me to easily create a third class that extends JApplet and just adds the already-written panel with most of the GUI logic set up. I only have to provide an alternative to the menu that was in the JFrame class. In a program of any major complexity, there are also other classes that do the actual work of the program. It's usually a good idea to separate the "business logic" from the "GUI logic" as much as possible.

To clarify my written explanation above, here's a quick example of some code:

HTH

Layne
I am Arthur, King of the Britons. And this is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 655 times.
Similar Threads
Running applets as an application
help with a class in an applet
how to detect which browser (IE or netscape) from applet
Copy Picture (Image)
Applet session sharing
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:10:30.