Simpel Applet virker ikke, hvorfor?
Hvorfor er det lige at nedenstående Applet ikke virker i en browser...? I AppletVieweren virker det dog fint som det skal.import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Test extends Applet implements MouseListener
{
Point mouseDown = null;
public void init()
{
addMouseListener(this);
}
public void paint(Graphics g)
{
if (mouseDown != null)
g.drawString("Her", (int) mouseDown.getX(), (int) mouseDown.getY());
}
public void mouseClicked(MouseEvent e)
{
mouseDown = new Point((int) e.getX(), (int) e.getY());
repaint();
}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
}