Methods Summary |
---|
public void | actionPerformed(java.awt.event.ActionEvent e)
if ( e.getSource() == theButton ) {
changeColor();
}
|
private void | changeColor()
if ( ++colorIndex == someColors.length )
colorIndex = 0;
setForeground( currentColor() );
repaint();
|
private java.awt.Color | currentColor()
return someColors[ colorIndex ];
|
public void | init()
theMessage = getParameter("message");
theButton = new Button("Change Color");
add(theButton);
addMouseMotionListener(this);
theButton.addActionListener(this);
|
public void | mouseDragged(java.awt.event.MouseEvent e)
messageX = e.getX();
messageY = e.getY();
repaint();
|
public void | mouseMoved(java.awt.event.MouseEvent e)
|
public void | paint(java.awt.Graphics gc)
gc.drawString( theMessage, messageX, messageY );
|