# JpopupMenu mouse hover visibility

**URL:** <https://forum.inductiveautomation.com/t/jpopupmenu-mouse-hover-visibility/30876>\
**Category:** Ignition\
**Created:** [December 20, 2019, 7:28pm UTC](https://forum.inductiveautomation.com/t/jpopupmenu-mouse-hover-visibility/30876 "2019-12-20T19:28:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacob.Gronlund](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Jacob.Gronlund](https://forum.inductiveautomation.com/u/Jacob.Gronlund)\
**Post date:** [December 20, 2019, 7:28pm UTC](https://forum.inductiveautomation.com/t/jpopupmenu-mouse-hover-visibility/30876/1 "2019-12-20T19:28:04Z")

</div>

Hi, I have a created a navigation window (north docked window) and am using JPopupMenu to act as the navigation per navigation field. I want to add a mouse listener to this JPopupMenu class so that when the user’s mouse is not hovering over the popup menu anymore the popupmenu disappears, similar functionality to most modern websites. Basically a mouseEntered and mouseExited function within the class. I have also added JMenu Items to this JPopupMenu so not sure if I need to add mouselisteners to each of their classes (not included in sample below).

Here is something that’s been started.

```auto
from java.awt.event import MouseListener
from javax.swing.event import PopupMenuListener

class MouseEventTest (MouseListener):
	def __init__ (hello) :
		print "init"
	def mousePressed(hello,hello2):
		print 'mousePressed'
	def mouseReleased(hello,hello2):
		print 'mouseReleased'
	def mouseEntered(hello,hello2):
		print 'mouseEntered'
	def mouseExited(hello,hello2):
		print 'mouseExited'

def sayHello(event):
	print "function execution"
	
menu = system.gui.createPopupMenu(["Click Me"], [sayHello])
listener = MouseEventTest()
menu.addMouseListener(listener)
menu.show(event)

```

^not sure how to make it appear correctly indented  
Also I do know that this system.gui.createPopupMenu() object is a Jython version of the JPopupMenu so they are not completely the same, but if I could keep using that it would be ideal because it has been easier to position.
