Discussion Locked

applet running problem(event )

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hello
please solve my java applet problem.
The following code compile successfully when i givw
the following commands->
c:\jdk1,2\bin\javac msact.java
but it does not compile when i give the following command->
c:\jdk1.2\bin\appletviewer msact.java
It says
exception in thread "main" java.util.MissingResourseException:
cant find resourse at.......

code is->
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*

*/
public class msact extends Applet
implements MouseMotionListener
{
String msg="";
int x=0,y=0;
public void init()
{
addMouseMotionListener(this);
}

public void mouseDragged(MouseEvent me)
{
x=me.getX();
y=me.getY();
msg="*";
showStatus("Dragging mouse at"+ x +"," +y);
repaint();}

public void mouseMoved(MouseEvent me)
{
msg="hello";
showStatus("moving mouse at"+ me.getX() +"," +me.getY());
repaint();
}

public void paint(Graphics g)
{ g.drawString(msg,x,y);
}

}

i dont get any exception when i run applet without mouse event,
keyword events. please tell me how to run this applet.

1 reply

by bhunt

Your problem is that Appletviewer does not take a .java file as input, it requires a HTML file as input.

That HTML file should have the format:

The applet class name is the name of the .class file of your compiled .java program (without the .class).

Hope that helps!

This discussion is closed to new replies.