From 68e8b0df265d4212d4c416222220a91334a627b1 Mon Sep 17 00:00:00 2001 From: Tyler Davis Date: Tue, 31 Mar 2020 12:16:47 -0700 Subject: [PATCH] swingutil: Set button tooltip text in addModalTooltip Prior to this commit, addModalTooltip only added a button listener to update the tooltip when its state changed. This, however, did not set the initial tooltip and leaves modal tooltip buttons in the client lacking a tooltip until they are toggled. This commit sets the initial tooltip state using the same toggle check as is used in the listener. --- .../src/main/java/net/runelite/client/util/SwingUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java index 5eb7cef4af..2b5b5caf70 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java @@ -297,6 +297,7 @@ public class SwingUtil public static void addModalTooltip(AbstractButton button, String on, String off) { + button.setToolTipText(button.isSelected() ? on : off); button.addItemListener(l -> button.setToolTipText(button.isSelected() ? on : off)); }