fix tooltip not being updated
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 6 Apr 2008 12:47:10 +0000 (12:47 +0000)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 6 Apr 2008 12:47:10 +0000 (12:47 +0000)
git-svn-id: http://trooper/svn/projects/jSite/trunk@618 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/jsite/gui/FixedJMenuItem.java

index 5f0940a..0aad34a 100644 (file)
@@ -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();
                                }
                        }
                };