Hi! Does somebody know how to get the total number of MenuItems in JPopupMenu? I'm searching for something like, popupmenu1.getNumberOfMenuItems(). I need it for the FOR statement

(for int i=0; i<popupmenu1.getNumberOfMenuItems(); i++) { ... }

Thanks!

Recommended Answers

All 2 Replies

try popupmenu1.getSubElements().length; .

Thank you! It seems to work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.