Add Image to JMenu

36 Views Asked by At

I can't for the life of me figure out how to add an icon besides the text on a JMenu. Everywhere I've looked on the internet I've only found how to add an icon on a JMenuItem but nothing on the JMenu itself. Can someone help me ? Thanks in advance.

1

There are 1 best solutions below

0
Rob Spoor On BEST ANSWER

JMenu extends JMenuItem which in turn extends AbstractButton. Both JMenu and JMenuItem inherit setIcon from AbstractButton. This is the same method that gets called when you create a JMenuItem with an Icon in the constructor. For JMenu you'll have to call it separately.