Home » Sometech » WAP in JAVA for handling Mouse events.

WAP in JAVA for handling Mouse events.

Java Coding

import java.awt.*;

  import java.awt.event.*;

  import java.applet.*;

  public class Mouse11 extends Applet implements MouseListener

  {

  public void init()

  {

  addMouseListener(this);

  }

  public void mouseClicked(MouseEvent e)

  {

  showStatus(“MouseClicked”);

  setBackground(Color.red);

  }

  public void mousePressed(MouseEvent e)

  {

  showStatus(“MousePressed”);

  setBackground(Color.green);

  }

  public void mouseEntered(MouseEvent e)

  {

  showStatus(“MouseEntered”);

  setBackground(Color.blue);

  }

  public void mouseExited(MouseEvent e)

  {

  showStatus(“MouseExit”);

  setBackground(Color.pink);

  }

  public void mouseReleased(MouseEvent e)

  {

  showStatus(“MouseReleased”);

  setBackground(Color.yellow);

  }

  }

  /*<applet code=”Mouse11″   height=”500″    width=”700″>

  </applet>*/

 

 

Advertisements

SoME Tech

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: