Reputation: 87
I want to know How can I differentiate that a Menu Item is of type Menu or MenuItem? As a Menu item can be of both types Menu or MenuItem
like in the code below Both menu and menuitem are added to Menu Object
Menu format=new Menu("Format");
Menu font=new Menu("Font");
format.add(font);
font.add(new MenuItem("Courier"));
font.add(new MenuItem("Sans Serif"));
font.add(new MenuItem("Monospaced"));
font.add(new MenuItem("Symbol"));
Upvotes: 1
Views: 40
Reputation: 1032
isMenuItem(MenuItem item) {
return (item instanceof MenuItem);
}
Upvotes: 1