what's wrong?

Discussion in 'Java' started by Guest, Sep 7, 2003.

  1. Guest

    Guest 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){}
    }
    ---------------------------------
    thanks!
     
    Guest, Sep 7, 2003
    #1
    1. Advertising

  2. Guest

    Ryan Stewart Guest

    "<- Chameleon ->" <> wrote in message
    news:bjf9rh$afh$...
    > 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){}
    > }
    > ---------------------------------
    > thanks!
    >
    >


    You may have a problem somewhere else in your code because that will compile
    and work fine if you define DoSomething() (which should be doSomething())
    and get rid of the dots in the paint method.
     
    Ryan Stewart, Sep 7, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Salisha Khan
    Replies:
    1
    Views:
    11,656
    JohnFol
    Aug 1, 2003
  2. Replies:
    2
    Views:
    394
  3. Pial
    Replies:
    4
    Views:
    56,732
    Phatman
    Aug 27, 2010
  4. Paul Leventis

    Re: Quartus bug or wrong VHDL?

    Paul Leventis, Jun 24, 2003, in forum: VHDL
    Replies:
    0
    Views:
    2,472
    Paul Leventis
    Jun 24, 2003
  5. Matthew
    Replies:
    7
    Views:
    673
    Priscilla Walmsley
    Jan 7, 2005
Loading...

Share This Page