classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Patch: MenuItem fix


From: Lillian Angel
Subject: Re: [cp-patches] Patch: MenuItem fix
Date: Tue, 01 Nov 2005 10:10:50 -0500

> > public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
> > {
> >+  
> >+  /**
> >+   * Creates a new BasicCheckBoxMenuItemUI object.
> >+   */
> >+  public BasicCheckBoxMenuItemUI()
> >+  {
> >+    super();
> >+    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
> >+    checkIcon = UIManager.getIcon("CheckBoxMenuItem.checkIcon");
> >+  }
> >+  
> 
> You don't need the defaults variable here. Also I would think that the
> checkIcon should actually be loaded by the BasicMenuItemUI via the
> getPropertyPrefix method.

I disagree. The prefix for BasicMenuItemUI is 'MenuItem'. The prefix for
BasicCheckBoxMenuItemUI is 'CheckBoxMenuItem'. If I changed it so
BasicMenuItemUI loads the checkIcon, the correct icon would not be
loaded.

> 
> >@@ -98,6 +99,6 @@
> >                                 MenuElement[] path,
> >                                 MenuSelectionManager manager)
> >   {
> >-    // TODO: What should be done here?
> >+    item.processMouseEvent(e, path, manager);
> >   }
> 
> I don't think that this is right. The API docs state that the
> JMenuItem.processMouseEvent should be called by the MenuSelectionManager
> (from the processMouseEvent method there). This in turn is most likely
> called by the BasicMenuItemUI.MouseInputHandler.

I agree, this is very confusing ATM. I am looking into it now.

> 
> However it is still not clear to me who is supposed to call the
> BasicCheckBoxMenuItemUI.processMouseEvent method. From JMenuItem is
> unlikely, because that would mean explicitly checking for
> BasicCheckBox/RadioButtonMenuItemUI. The same goes for the
> MenuSelectionManager. Most likely (but still somewhat strange) seems the
> BasicMenuItemUI.MouseInputHandler, though this still has to check for
> specific subclass of BasicMenuItemUI, since BasicMenuItemUI has no
> processMouseEvent method.

Lillian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]