FULL PRODUCT VERSION :
1.8.0_111
ADDITIONAL OS VERSION INFORMATION :
Windows 10 Pro Version 10.0.15063 Build 15063
A DESCRIPTION OF THE PROBLEM :
Dialogs, Menu Items and Context Menus appear on wrong screen when a JFrame is positioned on a secondary display that has been (re)connected AFTER application launch.
This ONLY happens when the application is launched using JWS.
"Manually" calling WToolkit.displayChanged() cures the problem.
This method is called by the evenLoop() when I debug the application in my IDE and connect my secondary display.
Therefor my conclusion is that this does not happen under JWS.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a simple JFrame application with a menu bar and some menu items.
One item might call the WToolkit.displayChanged().
Launch the application using JWS from web server
Physically connect a secondary display to your laptop, it should extend your desktop.
Drag the frame to the secondary display.
Click the Menu Bar.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Menu Items should appear underneath the Menu Bar
ACTUAL -
Menu Items appear on the primary display
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (environment instanceof DisplayChangedListener)
EventQueue.invokeLater(((DisplayChangedListener)environment)::displayChanged);