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: Roman Kennke
Subject: Re: [cp-patches] Patch: MenuItem fix
Date: Tue, 25 Oct 2005 08:51:23 +0200

Hi Lillian,

> Made a couple minor fixes to BasicCheckBoxMenuItemUI to match the API
> and BasicRadioButtonMenuItemUI.
> 
> 2005-10-21  Lillian Angel  <address@hidden>
> 
>         * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
>         (BasicCheckBoxMenuItem): Implemented.
>         (installDefaults): Removed method, not in API.
>         (processMouseEvent): Implemented.
>         * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
>         (processMouseEvent): Implemented.

> 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.

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

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.

Cheers, Roman

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

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