Hello , Iam new to applet programming, I want to invoke an applet from a class, The class file does some processing based on user input and the output is to be displayed in the applet, how do i do this? I would be thankful for the information provided.
If Java had true garbage collection, most programs would delete themselves upon execution -- Robert Sewell
Originally posted by Pavan Tummala: I want to invoke an applet from a class
That's relatively non-standard.
Usually you invoke an applet from an HTML page. I suspect that you mean either...
A) You have an applet running (from an HTML page in a browser) and you want to display some results from a class on the server. The usual flow there is... - The user brings the web page up in the browser. - The web page causes the browser to retrieve and start the Applet. - The Applet opens up another connection back to the server to get data. - The server sends data back to the Applet to be displayed.
B) You have a standalone (i.e. not client/server) program and you want to put a nice GUI window on the screen to display the results. In this case you want to put up a Frame or something similar, not an Applet.
C) Your program really is a Applet running in a browser but it's basically standalone in that there's no interaction with the server. In this case you already have the applet class, so you don't need to "invoke" it.
(Of course, I could be wrong; you might want to invoke an applet from another class.)
Did this help at all?
Joined: Dec 25, 2004
Thanks for the reply Ryan. That did give me a clear idea of how things work when using applets. Well this is what I need to do. It might sound really simple! I just have to display a graph and show the shortest path on the graph by highlighting the nodes on the shortest path. I though this is best done using applet. Is there a better and simpler way to do it? Again the user input is being taken from a txt file. So once i execute the program the result is displayed graphically.
Joined: Feb 18, 2005
Cool. Go look up java.awt.Frame or javax.swing.JFrame in the Java class docs. These are how you bring up a separate window when running your Java program from the command line.