It seems to be well-known there is a bug when using JMenuItem.getRootPane(). I read the bug description but i cannot figure out a workaround. Do you know work-around code for this in an Action.actionPerformed() method ? Thank you.
Update: I get this now but that don't work with sub-menus :-(
public void actionPerformed(ActionEvent e) {
Component c = (Component) e.getSource();
if (c instanceof JMenuItem) {
c = ((JPopupMenu)((JMenuItem)c).getParent()).getInvoker();
}
Component z = SwingUtilities.getRootPane(c);
}