×

Loading...

It seems that your concept is not quite clear here

jabber (jabber)
1. The following toy code is OK:

public class XXX extends JPanel implements MouseMotionListener{

JButton jButton = new jButton("Test");
jButton.addMouseMotionListener(this);

public void mouseDrapped(MouseEvent e){
//Do this
}
public void mouseMoved9MouseEvent e){
//Do that
}

}
Comments: "JButton.this" is at least a poor syntax.

2. In Java gragramming, it is a common practice to have a Container be an EventListener. But it is not a good idea to let Button or JButton be a listener. Academically, it is OK.
(#11891@0)
2000-10-24 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: java problem

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论