You don't need to use threads (explicitly, anyway) to listen for mouse clicks. Notice that the applet will not respond to mouse events unless you call addMouseListener with the applet itself (this). In order to update the display, you need to call repaint() in the mousePressed method, which will call the paint method. (Note that mouseClicked, rather than mousePressed, is probably what you want; it waits until the user has released the mouse button to fire the event.)
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class MouseTest extends Applet implements MouseListener
{
boolean hello;
public void init() {
hello = false;
addMouseListener(this);
}
public void paint(Graphics g)
{
if(hello)
g.drawString("Hello", 2, 10);
}
public void mouseClicked(MouseEvent evt)
{
hello = !hello;
repaint();
}
public void mousePressed(MouseEvent evt) { }
public void mouseEntered(MouseEvent evt) { }
public void mouseExited(MouseEvent evt) { }
public void mouseReleased(MouseEvent evt) { }
}