Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The event dispatcher will forward mouse events to the listeners registered to the component that is returned by the package-level <code>getMouseEventTarget</code> method in <code>Container</code>. This will be called on your <code>JFrame</code>, and, as the JavaDoc indicates, it:</p> <blockquote> <p>Fetchs the top-most (deepest) lightweight component that is interested in receiving mouse events.</p> </blockquote> <p>The event dispatcher then takes this top-most component (your <code>JTextField</code>, for example) and sends events to all of its listeners only. They do this in order to avoid having to broadcast these events to all of the components that may be layered within a Swing container. MouseEvents, as you can imagine, are very chatty, what with all of the <code>mouseEntered</code>, <code>mouseDragged</code>, and <code>mouseMoved</code> events that are dispatched for all of the <code>MouseListener</code> and <code>MouseMotionListener</code> implementations potentially out there. The processing to find all listeners and then fire events to all of them in the hierarchy would be time consuming.</p> <p>The assumption is also that for classes like <code>JTextField</code> and <code>JButton</code>, etc., the default mouse handling is all that one would need. If you want to handle mouse actions differently (ie, changing color on a <code>mouseEntered</code>/<code>mouseExited</code>), you can add a <code>MouseListener</code> to these widgets as you need to. </p> <p>For your processing, I would suggest simply adding your <code>JPanel</code> as a <code>MouseListener</code> to your top level components if you need to handled these events.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload