Am I right to think that it should be possible to remove a MenuBar.Item from a MenuBar? Or is there something special about MenuBar.Items? This simple test below throws because the MenuBar.Item's parent is set to null when it is removed from the MenuBar.ItemSequence.
If you compare the MenuBar.Item#setParent(Container) method with Menu.Item#setParent(Container) you will see that the MenuBar one doesn't check for nulls, but the Menu one does. http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/MenuBar.java Changing if (!(parent instanceof MenuBar)) { to if (parent != null && !(parent instanceof MenuBar)) { seems to sort things out. Example MenuBar menuBar = new MenuBar(); MenuBar.ItemSequence itemSequence = menuBar.getItems(); MenuBar.Item item = new MenuBar.Item("item"); itemSequence.add(item); itemSequence.remove(item); Exception in thread "main" java.lang.IllegalArgumentException: Parent must be an instance of org.apache.pivot.wtk.MenuBar at org.apache.pivot.wtk.MenuBar$Item.setParent(MenuBar.java:76) at org.apache.pivot.wtk.Container.remove(Container.java:198) at org.apache.pivot.wtk.Container.remove(Container.java:172) at org.apache.pivot.wtk.MenuBar$ItemSequence.remove(MenuBar.java:236) at org.apache.pivot.wtk.MenuBar$ItemSequence.remove(MenuBar.java:222) at pivot.testing.events.RemoveMenuBarItem.main(RemoveMenuBarItem.java:12) Chris
