How to Get and Import SwingUtilities

I'm trying to follow the script on the Topic " Open Template Popup at Mouse Location" but I do not know how to get and import the swing utilities. I appreciate your help. Thanks.

Just use those example scripts. SwingUtilities is part of java's desktop gui, and is always present in Vision.

I get this error.
Traceback (most recent call last):
File "event:mouseReleased", line 3, in
NameError: name 'SwingUtilities' is not defined

Show your code.

Wait! Are you trying to use this in Perspective? (You didn't tag your topic with either Perspective or Vision. These examples are Vision-only.)

Im using this on Vision.

param1 = event.source.ScreenJump
window = system.nav.openWindow('Popup/NAV SCREEN', {'Page' : param1})
newPoint = SwingUtilities.convertPoint(event.source, event.x, event.y, system.gui.getParentWindow(event).rootContainer)
window.setLocation(newPoint.x, newPoint.y)

You're not importing SwingUtilities. See Open Template Popup at Mouse Location - #7 by nminchin

1 Like

Ok I dont know what im doing wrong. It gives an error as my previous reply to pturmel

You're missing this line at the top of your script:

from javax.swing import SwingUtilities
1 Like

Thank you very much Sir. It did work.