JMenuItem with checkbox - on mac

From: Maik Heller (Maik.Heller_at_antispam.address)
Date: 10/28/04

  • Next message: Deborah K. Charan: "Updating of a Tree when the label changes"
    Date: Thu, 28 Oct 2004 13:15:06 +0200
    
    

    Hello,

    I want to place several kinds of JMenuItem s into a menu bar. All
    instances e.g. MyCheckBoxMenuItem are derived from MyMenuItem which in
    turn is derived from JMenuItem.

    To simplify the example, the custom menu item is derived directly from
    JMenuItem and actions are ignored...

    public class MyCheckBoxMenuItem extends JMenuItem {
            public MyCheckBoxMenuItem() {
                    super();
                    setModel(new JToggleButton.ToggleButtonModel());
            }
            public String getUIClassID() {
                    return "CheckBoxMenuItemUI"
            }
    }

    So, the item should be rendered as a checkbox menu item (getUIClassID())
    and the button state is managed by the model (setModel()). Everything's
    fine ... on windows.

    The problem is that the check state icon on mac is not rendered. As soon
    as I derive the class from JCheckBoxMenuItem, the item is rendered
    correctly.

    Any hints?


  • Next message: Deborah K. Charan: "Updating of a Tree when the label changes"
  • Quantcast