Forums Register Login

how to run applets classes ?

+Pie Number of slices to send: Send

Hi:
i have a class which extends applets.
in which I set the layouts, add components etc
i was wondering how to run the applet class ...
i tried to run it like a regular java application,
but it din't do much.
i also tried it with a html file like
"appletviewer Test.html"
In the html file I have

ToolStatus.java (RHE, p 277) is my file name ofcourse.
Could somebody help me with...what I am missing?
Thanks.
- satya
+Pie Number of slices to send: Send
Satya, This nature of your qstn is suitable more for Applets forum. So we will discuss it there.
regds
maha anna
+Pie Number of slices to send: Send

Maha:
First, I did not know about this Applet forum.
Second, I was doing it wrong. In my code, I created
a new Applet in the constructor and added my components
to this Applet. So, the Applet created in the main()
method was not showing my components.
I corrected it and it works.
Please close the thread. Sorry, my mistake.
Thanks.
- satya
+Pie Number of slices to send: Send
Satya,
It is very simple.
1. Compile the ToolStatus.java code. Keep the ToolStatus.class file ready.
2. create a <b>test.html</b> file like foll.
< html >
< applet code="ToolStatus.class" width=100 height=100 >
< /applet >
< /html >
3. In the Dos command prompt type <b>appletviewer test.html </b>
4. You will see the applet. (I purposly included space bet html tags in order to avoid this forum s/w from interpreting)
I tested with a simple helloworld.class . Appletviwer shows fine.
regds
maha anna

[This message has been edited by maha anna (edited April 29, 2000).]
[This message has been edited by maha anna (edited April 29, 2000).]
+Pie Number of slices to send: Send
Hi Satya5,
An applet will not run the same way as other java programs. There are two ways you can run them.
1. Using appletviewer.(the way you did)
2. By browsing the html file.
The html file should look something like this.
<html>
<head>
<title> Sample Applet</title>
</head>
<body>
<applet code = TryApplet.class width =300 height=200>
</applet>
</body>
</html>
The html file which you have created does not have the keyword
applet before the word code and hence is not working. You must be probably getting this error "No Applets were started. Make sure the input contains an <applet> tag."
This should work.
It's feeding time! Give me the food you were going to give to this 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 1373 times.
Similar Threads
Start: Applet not initialized
Applet in HTML
html and jar file?
Applets fail to load in a browser
HelloWorld not working
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:10:08.