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:16:31 -0500

On Tue, 2005-11-01 at 10:10 -0500, Lillian Angel wrote:
> > > 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.

Sorry I worded what I meant completely wrong (still on vacation).
BasicMenuItemUI paints the checkIcon if its not null (if we are really
painting a checkboxmenuitem). Therefore, we should not be initializing
the checkIcon in BasicMenuItemUI, but only in BasicCheckBoxMenuItemUI.

> > 
> > >@@ -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]