From: Niki Roo Date: Fri, 1 May 2020 10:05:31 +0000 (+0200) Subject: ListModel: tooltip/popup interactions X-Git-Tag: fanfix-swing-1.1.0~30 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=2b73ce2f5bef08dd28850f6e97614272947af79e;p=fanfix-swing.git ListModel: tooltip/popup interactions --- diff --git a/src/be/nikiroo/utils/ui/ListModel.java b/src/be/nikiroo/utils/ui/ListModel.java index 3029f61a..7103dbac 100644 --- a/src/be/nikiroo/utils/ui/ListModel.java +++ b/src/be/nikiroo/utils/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()); } }