⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testmousemotionlistener.java

📁 java2 primer plus一书源程序
💻 JAVA
字号:
/* * TestMouseMotionListener.java * * Created on July 30, 2002, 2:36 PM */package ch14;import java.awt.*;import java.awt.event.*;/** * * @author  Stephen Potts * @version */public class TestMouseMotionListener extends Frame                    implements MouseMotionListener{   Button btnExit;      /** Creates new TestMouseMotionListener*/   public TestMouseMotionListener()   {      btnExit = new Button("Exit");      btnExit.setFont(new Font("Courier", Font.BOLD, 24));      btnExit.setBackground(Color.cyan);      addMouseMotionListener(this);            add(btnExit);      this.setLayout(new FlowLayout());           addWindowListener(new WinCloser());      setTitle("Using a ComponentListener");      setBounds( 100, 100, 300, 300);      setVisible(true);   }      public void mouseMoved(MouseEvent me)   {       System.out.println("Mouse was Moved");       System.out.println(me.getX() + "," + me.getY());   }   public void mouseDragged(MouseEvent me)   {       System.out.println("Mouse was Dragged");       System.out.println(me.getX() + "," + me.getY());   }       public static void main(String[] args)   {      TestMouseMotionListener tmml = new TestMouseMotionListener();   }   }class WinCloser extends WindowAdapter{   public void windowClosing(WindowEvent e)   {      System.exit(0);   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -