FileDocCategorySizeDatePackage
HelloWeb3.javaAPI DocExample1201Sat Apr 04 02:58:20 BST 1998None

HelloWeb3

public class HelloWeb3 extends Applet implements ActionListener, MouseMotionListener

Fields Summary
int
messageX
int
messageY
String
theMessage
Button
theButton
int
colorIndex
static Color[]
someColors
Constructors Summary
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

		if ( e.getSource() == theButton ) {
			changeColor();
		}
	
private voidchangeColor()

		if ( ++colorIndex == someColors.length )
			colorIndex = 0;
		setForeground( currentColor() );
		repaint();
	
private java.awt.ColorcurrentColor()

		return someColors[ colorIndex ];
	
public voidinit()

	
	   
		theMessage = getParameter("message");
		theButton = new Button("Change Color");
		add(theButton);

		addMouseMotionListener(this);
		theButton.addActionListener(this);
	
public voidmouseDragged(java.awt.event.MouseEvent e)

		messageX = e.getX(); 
		messageY = e.getY();
		repaint();
	
public voidmouseMoved(java.awt.event.MouseEvent e)

 
public voidpaint(java.awt.Graphics gc)

		gc.drawString( theMessage, messageX, messageY );