/**
  * Applet malen1 zum Umgang Mausbewegungen
  * @version 1.0 vom 14.10.04
  * @author Michael Martin
  */
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class MausKoordinaten extends java.applet.Applet implements MouseMotionListener
{
  Label titelLabel = new Label("Bewegen der Maus");
  Label koordLabel=new Label();

  void koordLabelAnzeigen(int x,int y)
  { koordLabel.setText(""+x+","+y);
  }
      
  public void init()
  { titelLabel.setBackground(Color.green);
    setLayout(null);
    titelLabel.setBounds(10,10,150,20);
    add(titelLabel);
    koordLabel.setBounds(170,10,100,20);
    add(koordLabel);
    addMouseMotionListener(this);
  } // Ende von init()
  
  public void mouseMoved(MouseEvent e)
  { int x=e.getX();
    int y=e.getY();
    koordLabel.setBackground(Color.red);
    koordLabelAnzeigen(x,y);
  }
  public void mouseDragged(MouseEvent e)
  { int x=e.getX();
    int y=e.getY();
    if (e.isMetaDown()) //rechte Maustaste
       koordLabel.setBackground(Color.blue);
    else
       koordLabel.setBackground(Color.yellow);
    koordLabelAnzeigen(x,y);
  }
}  // von malen1
