views:

435

answers:

3
A: 

In Java 6 on Windows, I cannot get the popup to even display with the code you have provided. On the other hand, if I change your superclass to JFrame, it works as desired, with the popup going away when I click outside of the window. Is there a reason why you are using JWindow as your superclass and not JFrame? If you wish to have a border-less/title-less window, you can call setUndecorated(true) on your JFrame (before you set visible and pack, of course.)

akf
i switched to JFrame but same thing is happening i updated the question explaining it.
Hamza Yerlikaya
A: 

What about hiding the menu if it's visible from within the MouseExited method?

JRL
when other non java windows has focus, they are not triggered.this is a little on always on top window where people can drag and drop things.
Hamza Yerlikaya
+1  A: 

Take a look at the Java Doc for JWindow.isFocusableWindow A JWindow cannot be the focused window unless it has an owner and the owner is visible. You're using the default constructor, so your JWindow has the shared owner asn is not focusable. When it is not focusable, it cannot detect the loss of focus when you click somewhere else.

I changed JWindow to JFrame and added a call to setUndecorated(true); before the call to setVisible and it's working for me. If these changes do not make it work for you, please post the version of Java you are using: java -fullversion

Devon_C_Miller