1、当鼠标键被按下、释放或单击(按下并释放)时发生动作事件

方法摘要:

mouseClicked(MouseEvent e)   鼠标按键在组件上单击(按下并释放)时调用。

 

 1  public class MouseAdapterTest extends Frame
 2  {
 3       public static void main(String[] args)
 4       {
 5           Frame f = new Frame();
 6           f.setBounds(500, 500, 200, 200);
 7           f.addMouseListener(new asd());
 8           f.setVisible(true);
 9       }
10  }
11  class asd extends MouseAdapter
12  {
13      @Override
14      public void mouseClicked(MouseEvent e) {
15          System.out.println("鼠标点击了");
16      }
17  }