The Artima Developer Community
Sponsored Link

Java Answers Forum
Mouse listener (application)

2 replies on 1 page. Most recent reply: Jul 7, 2005 3:15 AM by Antonio

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Ludo Stroetenga

Posts: 4
Nickname: ludo
Registered: Mar, 2004

Mouse listener (application) Posted: Jan 10, 2005 4:59 AM
Reply to this message Reply
Advertisement
I created a checkers program and instead of working with the keyboard i would like to work with the mouse by clicking on the stones i want to move. can someone give me a little help with this.

i have created on the form some pictureboxes how do i watch if on one of these picture boxes is clicked.

i already implemented Mouselistener and created the obligatory abstract methods.

but
Blackfield.addOnMouseEnter(new MouseEventHandler(this.mouseEntered));

does not seem to work because mouseEntered has got only one parameter (MouseEvent e).

please help or direct me to a sample source.

kind regards,
Ludo Stroetenga


Antonio

Posts: 33
Nickname: arhak
Registered: Jul, 2005

Re: Mouse listener (application) Posted: Jul 7, 2005 3:13 AM
Reply to this message Reply
I'm not sure about what are you asking, but it seems to me like you meant
blackfield.addMouseListener(
  new MouseAdapter() {
    public void mouseEntered(MouseEvent e) {
      this.mouseEntered(e);
    }
  }
);

this is how you delegate it to this.mouseEntered
Are you sure you are talking about Java?

Antonio

Posts: 33
Nickname: arhak
Registered: Jul, 2005

Re: Mouse listener (application) Posted: Jul 7, 2005 3:15 AM
Reply to this message Reply
sorry, I meant

blackfield.addMouseListener(
  new MouseAdapter() {
    public void mouseEntered(MouseEvent e) {
      OuterClass.this.mouseEntered(e);
    }
  }
);


where "OuterClass" is the name of the clas containing this code.

Flat View: This topic has 2 replies on 1 page
Topic: How to change the sepcified string color in a TextArea or  JTextArea? Previous Topic   Next Topic Topic: Upcasting

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use