Search:

Type: Posts; User: Norm

Search: Search took 0.21 seconds.

  1. Replies
    10
    Views
    2,047

    Re: Adding a mouse listener to my Draughts game

    Why not cast the reference returned by getSource() to the component's class that created the event and call its method directly.
  2. Replies
    10
    Views
    2,047

    Re: Adding a mouse listener to my Draughts game

    Look at the API doc for the event object that is passed to the mouse listener methods. If you can get a reference to the component that created the mouse event, you could call its methods.

    For a...
  3. Replies
    10
    Views
    2,047

    Re: Adding a mouse listener to my Draughts game

    If the squares are components, the event object passed to the listener method could have a reference to it.
    Look at the getSource() method.
  4. Replies
    10
    Views
    2,047

    Re: Adding a mouse listener to my Draughts game

    After the call to setBackground you'll probably need to call repaint() to have the new color shown.
  5. Replies
    10
    Views
    2,047

    Re: Adding a mouse listener to my Draughts game

    Please post the full text of the compiler's error messages.

    On which component(s) do you want the mouse's movements detected? Add the listener to that/those component(s).
Results 1 to 5 of 5