# Icon beside each item in popup menu

**URL:** <https://forum.inductiveautomation.com/t/icon-beside-each-item-in-popup-menu/11663>\
**Category:** Ignition\
**Created:** [May 13, 2016, 5:17am UTC](https://forum.inductiveautomation.com/t/icon-beside-each-item-in-popup-menu/11663 "2016-05-13T05:17:00Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 13, 2016, 12:08pm UTC](https://forum.inductiveautomation.com/t/icon-beside-each-item-in-popup-menu/11663/2 "2016-05-13T12:08:26Z")

</div>

You can do it by creating your popup menu with the underlying java classes instead of system.gui.createPopupMenu(). If you look at [JMenuItem](http://docs.oracle.com/javase/8/docs/api/javax/swing/JMenuItem.html), you’ll see it has a constructor that takes an icon and a string. You can use this code to get you started:

```auto
def showPopup(event):
	if not event.popupTrigger:
		return
	from javax.swing import JPopupMenu, JMenuItem
	menu = JPopupMenu()
	x = JMenuItem("Show Tag Tree")
	def showTagTreeAction(event, comp=event.source.parent.getComponent("TagTree")):
		comp.visible = True
	x.addActionListener(showTagTreeAction)
	menu.insert(x, TagTreeIdx)
	menu.show(event.source, event.x, event.y)

```

Note that the show() method for a manually constructed JPopupMenu is different.

---

_[View the full topic](https://forum.inductiveautomation.com/t/icon-beside-each-item-in-popup-menu/11663)._
