Get active screen


Is there method in Intellij that can get which screen is active if I'm using more than 1 monitor? Now i'm checking in a bad way like this:

for (Window w : window) 
if (w.toString().contains(e.getProject().getName()))

I'm using it to JFrame (it by default display on main monitor). How can I do it correctly and have same behaviour as build-in frames (like new Java Class)?

1 comment

You can use `com.intellij.openapi.wm.WindowManager#getFrame` to get JFrame by Project.
There is also `com.intellij.openapi.wm.ex.WindowManagerEx#getMostRecentFocusedWindow`.

You can also try using `com.intellij.openapi.ui.FrameWrapper` to spawn new windows.


Please sign in to leave a comment.