permaculture playing cards*
The moose likes Applets and the fly likes rookie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "rookie" Watch "rookie" New topic
Author

rookie

Pavan Tummala
Ranch Hand

Joined: Dec 25, 2004
Posts: 74
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.

Pavan


If Java had true garbage collection, most programs would delete themselves upon execution -- Robert Sewell
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
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?

Ryan
Pavan Tummala
Ranch Hand

Joined: Dec 25, 2004
Posts: 74
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.

Thanks
Pavan
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
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.

Ryan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rookie
 
Similar Threads
WebPage can't run applet as signed after another signed applet is disabled
include a actionlistener class in applet tags
Getting the applet to die on exit...
Convert .class to .exe
run applet from java class