Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why I can't see my applet after compile

Status
Not open for further replies.

Gert

Programmer
Apr 9, 2000
240
DO
Sorry but I'm new in Java languaje and I've been trying to build some applets.

I got Windows 98 in one PC and ME in another.
but after compile the applet I've been tryn to use the appletviewer to see the applet but it does'nt work.
I'm trying to see with the explorer but i got the same results.

Could some body tellme some resons about it, any help please.
F1, F1
 
Try to post your code here - maybe we can then try to help you with your specific problem :)
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
this is the code, I put this in an HTML page:
<HTML>
<BODY>
<APPLET CODE = “Welcome.class”
width = “500” height = ”200”>
<PARAM NAME = “texto” VALUE = “Un experimento con JAVA 2”>
<PARAM NAME = “x” VALUE = “10”>
<PARAM NAME = “y” VALUE = “50”>
</APPLET>
</BODY>
</HTML>

// un primer prog java
import java.applet.*; // Importa la clase applet
import java.awt.*; // Importa la clase grafica
public class Welcome extends Applet{
String texto;
int x;
int y;
public void init(){
texto = getParameter(&quot;texto&quot;);
try{
x= Integer.parseInt(getParameter(&quot;x&quot;));
y= Integer.parseInt(getParameter(&quot;y&quot;));
}catch( NumberFormatException ex){
}
}
public void paint(Graphics g){
g.setFont ( new Font(&quot;TimesRoman&quot;,
Font.BOLD+Font.ITALIC,24));
g.drawString(texto,x,y);
}
}
 
Your codes are working fine. I guess it has something to do with your pc instead? and did you put the 2 files in the same directory?

Hope this helps,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top