Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
IDs of MenuItems are weird
Hello,
I've created a menubar with four (!) items. I set the command to
Command click = new Command() {
@Override
public void menuSelected(MenuItem selectedItem) {
Notification.show("Clicked " + selectedItem.getId());
}
};
The notifcations shows ...
- ... "Clicked 2" for the first item
- ... "Clicked 3" for the second item
- ... "Clicked 4" for the third item
- ... "Clicked 5" for the fouth item
However, I would excpect to see "Clicked 0", "Clicked 1" and so on or at least "Clicked 1", "Clicked 2" ...
Why are the ids of MenuItems that strange? And are they reliable? Can I use them to refer to a particular item?
Thanks :)
Knee-jerk reaction says that item 0 is the menu bar itself, while item 1 is the submenu container.
Patrik Lindström: Knee-jerk reaction says that item 0 is the menu bar itself, while item 1 is the submenu container.
Ah, thank you :)