I have a single client with multiple desktops-window opened in some monitors. I want to get the size (w,h) of each monitor, depending of the current monitor where the window appears.
I’ve been testing some options but I don’t get into the correct one. I used system.gui.getScreens()
, but I need to identify in a window script which is the index of the current monitor where this windows it’s been shown, but I don’t know how.
I also tried with:
from javax.swing import JFrame, SwingUtilities
window = system.gui.getParentWindow(event)
frame = SwingUtilities.getAncestorOfClass(JFrame, window)
width=frame.width
height=frame.height
But I get the error
also tried
import java.awt
gd=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
width = gd.getDisplayMode().getWidth()
height = gd.getDisplayMode().getHeight()
But this one only gives the default monitor info. I wish .getCurrentScreen()
exists…
I also some other codes but I get errors or not desired behavior.
I need some advices please!!