G
Guest
In "extends Label" class that follows, I want, when I click mouse over the object, something happens.
I believe my code is correct but when I click mouse over the object nothing happens...
Can you help me?
------File: h.java--------------------
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class h extends Label implements MouseListener
{
public h() { addMouseListener(this); }
public final void update(Graphics g) { paint(g); }
public final void paint(Graphics g) { ........ }
public void mouseClicked(MouseEvent e){
DoSomething(); // fake function ;-)
}
public void mouseExited(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mousePressed(MouseEvent e){}
}
I believe my code is correct but when I click mouse over the object nothing happens...
Can you help me?
------File: h.java--------------------
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class h extends Label implements MouseListener
{
public h() { addMouseListener(this); }
public final void update(Graphics g) { paint(g); }
public final void paint(Graphics g) { ........ }
public void mouseClicked(MouseEvent e){
DoSomething(); // fake function ;-)
}
public void mouseExited(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mousePressed(MouseEvent e){}
}