mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
relocate the tooltip when a new cell is hovered over, even if it contains the same text
This commit is contained in:
@@ -174,9 +174,28 @@ public final class EditorTableView<T extends InventoryItem> {
|
|||||||
if (null == val) {
|
if (null == val) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _getCellTooltip(getCellRenderer(row, col), row, col, val);
|
return _getCellTooltip(getCellRenderer(row, col), row, col, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int lastTooltipRow = -1;
|
||||||
|
private int lastTooltipCol = -1;
|
||||||
|
private Point lastTooltipPt;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getToolTipLocation(MouseEvent e) {
|
||||||
|
Point p = e.getPoint();
|
||||||
|
final int row = rowAtPoint(p);
|
||||||
|
final int col = columnAtPoint(p);
|
||||||
|
if (row == lastTooltipRow && col == lastTooltipCol) {
|
||||||
|
p = lastTooltipPt;
|
||||||
|
} else {
|
||||||
|
lastTooltipRow = row;
|
||||||
|
lastTooltipCol = col;
|
||||||
|
lastTooltipPt = p;
|
||||||
|
}
|
||||||
|
return new Point(p.x + 10, p.y + 20);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
table.addFocusListener(new FocusListener() {
|
table.addFocusListener(new FocusListener() {
|
||||||
|
|||||||
Reference in New Issue
Block a user