diff --git a/src/studio/ui/Toolbar.java b/src/studio/ui/Toolbar.java index faa143d0..61cd69d3 100644 --- a/src/studio/ui/Toolbar.java +++ b/src/studio/ui/Toolbar.java @@ -4,8 +4,6 @@ import org.apache.logging.log4j.Logger; import javax.swing.*; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; public class Toolbar extends JToolBar { @@ -16,6 +14,12 @@ public JButton add(Action a) { JButton btn = super.add(a); updateTooltipTest(btn); + a.addPropertyChangeListener( e-> { + if (e.getPropertyName() == Action.ACCELERATOR_KEY) { + updateTooltipTest(btn); + } + }); + return btn; } @@ -30,15 +34,4 @@ private void updateTooltipTest(JButton btn) { btn.setToolTipText(tooltip); } - @Override - protected PropertyChangeListener createActionChangeListener(JButton b) { - return new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getPropertyName() == Action.ACCELERATOR_KEY) { - updateTooltipTest(b); - } - } - }; - } }