aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Newbie problem with Event ... MouseListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Newbie problem with Event ... MouseListener" Watch "Newbie problem with Event ... MouseListener" New topic
Author

Newbie problem with Event ... MouseListener

Tirthankar Mukherjee
Ranch Hand

Joined: Apr 08, 2006
Posts: 51


Can anyone take the pain to compile this code and see why my mousePressed() is not getting called. I this program I am trying make a GUI ChessBoard.
Thanks in Advance...
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
comment out this line, recompile/rerun

//square.setToolTipText(Integer.toString(i));
Tirthankar Mukherjee
Ranch Hand

Joined: Apr 08, 2006
Posts: 51
Michael Dunn wrote:comment out this line, recompile/rerun

//square.setToolTipText(Integer.toString(i));


ThankYou for your fast reply , the problem is solved ! But can you explain me why ??? Whats the problem with that ??
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
the panel (square) is on top, setToolTipText adds a mouseListener to the panel,
and when fired, consumes the event.

you would need to add a separate mouseListener to the panel, then dispatch the event to the layeredPane
Tirthankar Mukherjee
Ranch Hand

Joined: Apr 08, 2006
Posts: 51
ThankYou again Michael Dunn , you really took me out of this soup !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie problem with Event ... MouseListener