Hi, I am having a challenge with this.. I just read a book on Java Applet and there is something that is confusing to me. i need help on that..

There are two programs here...

import java.awt.Graphics;
import java.swing.JApplet;

public class TryMe extends JApplet {

public void paint (Graphics g)
{
super.paint(g);

g.drawString ("Welcome", 350, 100)
}

}

The other one is :

<HTML>
<Applet Code="TryMe.class">
<\JApplet>
<\HTML>

Where am i going to save the second code and also how exactly do i execute this code so that i can see the string on my Browser of AppletViewer?

Thanks

there are a number of errrors here:
1. its

import javax.swing.JApplet;

NOT

import java.swing.JApplet;

.
2. theres a missing ; after your drawString
3. your HTML file shouldnt have the <JApplet> tag. Use <applet> instead. And remember to open and close your tags.
4. when closing tags, it shouldnt be <\HTML> it should be </HTML>

the second code will be saved in a .html file, in the same directory as your .class file (which you have to obviously compile first).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.