Custom painting and mouse events

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 2022 Views - Last Post: 07 March 2011 - 06:42 PM Rate Topic: -----

#16 bmcginnis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 130
  • Joined: 21-February 09

Re: Custom painting and mouse events

Posted 07 March 2011 - 06:38 AM

Problem resolved, I needed to add:
addMouseListener(this(


to the new constructor with param (LayDes lay) instead of where it was, in the default constructor.

Thanks everyone for the help, Brian.
Was This Post Helpful? 0
  • +
  • -

#17 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8325
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Custom painting and mouse events

Posted 07 March 2011 - 06:42 PM

For a canvas to react to a mouseListener() I almost sure you have to

canvas.isFocusable(true);
canvas.requestFocus();
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2