Scripting with the Size

Hi all,

I need to know the size of the main window that the Client is seeing to know the resolution of his monitor. I have used [color=#0000FF]“aux = event.source.parent.parent.parent.parent.size”[/color] but it returns a “Dimension” type, so I can’t read the width and height or use string replace or something…

Any idea? Thanks a lot.

Raul.

How about this:

h=event.source.parent.parent.parent.parent.size.height
w=event.source.parent.parent.parent.parent.size.width

[quote=“r.dominguez”]
I need to know the size of the main window that the Client is seeing to know the resolution of his monitor…[/quote]

Just to stress a perhaps minor point, the window will be smaller than screen resolution. It will be affected if something like the menu bar is showing.

Hope this helps!

Sorry, couldn’t let this one pass…

This one will get screen resolution for you.

import java.awt
gd=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
width = gd.getDisplayMode().getWidth()
height = gd.getDisplayMode().getHeight()

Hi Jordan,

thanks for all the replies! This one did the trick!!

[color=#0000FF]size_string1 = event.source.parent.parent.parent.parent.height
size_string2 = event.source.parent.parent.parent.parent.width

event.source.parent.getComponent(‘Label 2’).text = str(size_string1)
event.source.parent.getComponent(‘Label 3’).text = str(size_string2)[/color]

Thanks again!!