From: Niki Roo Date: Fri, 1 May 2020 10:05:31 +0000 (+0200) Subject: ListModel: tooltip/popup interactions X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=ae474ca4ecdbbb4fbf45712cd650f99f91de649f;p=nikiroo-utils.git ListModel: tooltip/popup interactions --- diff --git a/ui/ListModel.java b/ui/ListModel.java index 3029f61..7103dba 100644 --- a/ui/ListModel.java +++ b/ui/ListModel.java @@ -275,7 +275,7 @@ public class ListModel extends DefaultListModel6 { hoveredIndex = index; fireElementChanged(oldIndex); fireElementChanged(index); - + Window oldTooltip = tooltip; tooltip = null; if (oldTooltip != null) { @@ -298,6 +298,11 @@ public class ListModel extends DefaultListModel6 { return; } + if (popup != null + && popup.isShowing()) { + return; + } + tooltip = newTooltip(index, me); } }); @@ -340,6 +345,12 @@ public class ListModel extends DefaultListModel6 { list.locationToIndex(e.getPoint())); } + Window oldTooltip = tooltip; + tooltip = null; + if (oldTooltip != null) { + oldTooltip.setVisible(false); + } + popup.show(list, e.getX(), e.getY()); } }