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++) { ... }


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 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.