首页 > 代码库 > Java 事件和事件监听

Java 事件和事件监听

 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 MouseAdapter12 {13     @Override14     public void mouseClicked(MouseEvent e) {15         System.out.println("鼠标点击了");16     }17 }

技术分享

Java 事件和事件监听