java problem

oldsix (oldsix)
here is the application of java.when it compile ,what will be complained by compiler?Why?what's the deference between using the ActionListener and MouseMotionListener?
How to apply the function that listen the mouse motion event by the button?

why?
import java.awt.event.*;
import javax.swing.*;

public class A extends JPanel{
JButton jb=new JBUtton("test");
JTextField txt=new JTextField(20);
jb.addMouseMotionListener(new MouseMotionListener(){
public void mouseDrapped(MouseEvent e){}
public void mouseMoved9MouseEvent e){
txt.setText("Done!");
}
});
public static void main(String[] args){
JFrame frame=new JFrame();
frame.getContentPane().add(new A());
frame.setSize(300,200);
frame.setVisible(true);
}
}
(#11686@0)
2000-10-23 -05:00

回到话题: java problem

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论

URL:   
http://www.rolia.net/zh/post.php?f=0&p=11686