dcsimg

How can I display an image instead of text in a menu?

Chandra Patni

You can simply use this code to create a JMenu with icon.


JMenu menu = new JMenu();
menu.setIcon(new ImageIcon("App.gif"));

If you want no text in the menu, simply set its text to null.