From e5c7a1609ef6d0878f98c3e8c2819bc1430f96f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 6 Apr 2008 12:47:10 +0000 Subject: [PATCH] fix tooltip not being updated git-svn-id: http://trooper/svn/projects/jSite/trunk@618 c3eda9e8-030b-0410-8277-bc7414b0a119 --- .../pterodactylus/jsite/gui/FixedJMenuItem.java | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/net/pterodactylus/jsite/gui/FixedJMenuItem.java b/src/net/pterodactylus/jsite/gui/FixedJMenuItem.java index 5f0940a..0aad34a 100644 --- a/src/net/pterodactylus/jsite/gui/FixedJMenuItem.java +++ b/src/net/pterodactylus/jsite/gui/FixedJMenuItem.java @@ -62,29 +62,33 @@ public class FixedJMenuItem extends JMenuItem { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { String propertyName = propertyChangeEvent.getPropertyName(); JMenuItem menuItem = FixedJMenuItem.this; - if (propertyChangeEvent.getPropertyName().equals(Action.NAME)) { - String text = (String) propertyChangeEvent.getNewValue(); - menuItem.setText(text); - menuItem.repaint(); - } else if (propertyName.equals("enabled")) { + if ("enabled".equals(propertyName)) { Boolean enabledState = (Boolean) propertyChangeEvent.getNewValue(); menuItem.setEnabled(enabledState.booleanValue()); menuItem.repaint(); - } else if (propertyChangeEvent.getPropertyName().equals(Action.SMALL_ICON)) { - Icon icon = (Icon) propertyChangeEvent.getNewValue(); - menuItem.setIcon(icon); - menuItem.invalidate(); + } else if (Action.NAME.equals(propertyName)) { + String text = (String) propertyChangeEvent.getNewValue(); + menuItem.setText(text); + menuItem.repaint(); + } else if (Action.SHORT_DESCRIPTION.equals(propertyName)) { + String shortDescription = (String) propertyChangeEvent.getNewValue(); + menuItem.setToolTipText(shortDescription); menuItem.repaint(); - } else if (propertyChangeEvent.getPropertyName().equals(Action.MNEMONIC_KEY)) { + } else if (Action.MNEMONIC_KEY.equals(propertyName)) { Integer mn = (Integer) propertyChangeEvent.getNewValue(); menuItem.setMnemonic(mn.intValue()); menuItem.invalidate(); menuItem.repaint(); - } else if (propertyChangeEvent.getPropertyName().equals(Action.ACCELERATOR_KEY)) { + } else if (Action.ACCELERATOR_KEY.equals(propertyName)) { KeyStroke keyStroke = (KeyStroke) propertyChangeEvent.getNewValue(); menuItem.setAccelerator(keyStroke); menuItem.invalidate(); menuItem.repaint(); + } else if (Action.SMALL_ICON.equals(propertyName)) { + Icon icon = (Icon) propertyChangeEvent.getNewValue(); + menuItem.setIcon(icon); + menuItem.invalidate(); + menuItem.repaint(); } } }; -- 2.7.4