List of utility methods to do Swing Mouse
void | removeMouseListenerToHierarchy(JComponent c, MouseListener listener) Removes the given MouseListener from all components in a hierarchy. for (Component comp : c.getComponents()) { comp.removeMouseListener(listener); if (comp instanceof JComponent) { removeMouseListenerToHierarchy((JComponent) comp, listener); |
void | removePopup(JComponent mouseEvtComp) unregisters a component from listen to mouse events for the popupMenu dictionary.remove(mouseEvtComp); |
void | retargetMouseEvent(int id, MouseEvent e, Component target) retarget Mouse Event if (target == null || (target == e.getSource() && id == e.getID())) { return; if (e.isConsumed()) { return; Point p = SwingUtilities.convertPoint((Component) e.getSource(), e.getX(), e.getY(), target); MouseEvent retargeted = new MouseEvent(target, id, e.getWhen(), e.getModifiersEx() | e.getModifiers(), p.x, ... |
void | retargetMouseEvent(int id, MouseEvent e, Component target) retarget Mouse Event if ((target == null) || ((target == e.getSource()) && (id == e.getID()))) { return; if (e.isConsumed()) { return; Point p = SwingUtilities.convertPoint((Component) e.getSource(), e.getX(), e.getY(), target); MouseEvent retargeted = new MouseEvent(target, id, e.getWhen(), ... |
void | retargetMouseEvent(MouseEvent e, Component target) retarget Mouse Event if ((target == null) || ((target == e.getSource()))) { return; if (e.isConsumed()) { return; target.dispatchEvent(SwingUtilities.convertMouseEvent(e.getComponent(), e, target)); |
int | rowAtPoint(MouseEvent mouseEvent) Assuming the mouseEvent occurred over a JTable , retrieve the row over which the event occurred.
final JTable table = (JTable) mouseEvent.getSource(); final Point clickPoint = mouseEvent.getPoint(); return table.rowAtPoint(clickPoint); |
void | setHintOnMouseHover(JComponent view, String tooltip, JLabel onView) set Hint On Mouse Hover view.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { super.mouseEntered(e); onView.setText(tooltip); @Override public void mouseExited(MouseEvent e) { ... |
boolean | shouldIgnore(MouseEvent me, JComponent c) Ignore mouse events if the component is null, not enabled, the event is not associated with the left mouse button, or the event has been consumed. return c == null || !c.isEnabled() || !SwingUtilities.isLeftMouseButton(me) || me.isConsumed();
|
void | swingDispatch(MouseEvent e, Component component) swing Dispatch swingDispatch(e, e.getPoint(), component); |