Skip to content

Commit

Permalink
chore(interactive-jtable): Check if mouse event is within using bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
bric3 committed Mar 25, 2024
1 parent d95ef36 commit 478763f
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -774,16 +774,17 @@ public ProperMouseEnterExitListener(InteractiveJTable interactiveTable) {
if (source instanceof JComponent) {
var comp = (JComponent) source;
// The actual received event may come from a different component than the table
var tableMouseEvent = SwingUtilities.convertMouseEvent(comp, (MouseEvent) awtEvent, interactiveTable);
if (SwingUtilities.isDescendingFrom(comp, interactiveTable)) { // TODO check if within bounds ?
var tableMouseEvent = SwingUtilities.convertMouseEvent(
comp,
(MouseEvent) awtEvent,
interactiveTable
);
if (interactiveTable.contains(tableMouseEvent.getPoint())) {
// The mouse is in the house...

listeners.forEach(l -> l.mouseMoveWithin(tableMouseEvent));
//rowHoveringListener.performHovering(() -> interactiveTable.rowAtPoint(SwingUtils.getLastPointerLocation(interactiveTable)));
} else {
// Mouse is outside
listeners.forEach(l -> l.mouseOut(tableMouseEvent));
//rowHoveringListener.performHovering(() -> -1);
}
}
}, AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
Expand Down

0 comments on commit 478763f

Please sign in to comment.