IP Camera Viewer image resize on mouseover

Is there a way to script an IP Camera element to grow in size on mouse over? I have 8 cameras on a screen in a ‘live thumbnail’ kind of setup, i would like to be able to mouse over one and see a larger version of it (even if it covers the other elements or moves them to the side). ideally, a small delay (250ms or so maybe) would be great to keep from bogging everything down when you move across the screen quickly, but that might be asking a bit much :slight_smile:

Yes. There are scripting functions to resize components or move components. You can do the following:comp = event.source.parent.getComponent("IP Camera") system.gui.resizeComponent(comp, 500, 600)You can specify a new width and height. You can set it back to the original when you move your mouse off. Make sure the width and height you use is relative to the size in the designer because we will translate it automatically for you in the client.

ah, that worked perfectly. Is there a way to change its layer/alignment so that when it enlarges it will automatically be on ‘top’ of the other views?

In the designer, click on the IP camera component and bring it to the front. As long as you save it that way it will be on top of everything else.

is there a way to call that with a script? the last one i set to ‘front’ stays in the front, and when I mouse over and it enlarges, everything is OK. The problem is the other 7 IP Cam viewers, when they enlarge, they are ‘under’ the one. Im looking under the guides for system.gui scripts but Im not seeing anything that can help. Maybe adjusting how everything is positioned? right now everything is pretty well anchored by its top left corner.

You can change the z order of a component at runtime using setComponentZOrder() on a root container instance, passing in a component instance and the z-order index:


You would put that code in your mouseEntered event. Setting the z-order to 0 for a component ensures it will overlap any other component in the window. Changing the z-order of one component will change the z-order for all components, but that shouldn’t matter since the only time your IP Camera components are overlapping is during the mouseEntered event.

thats it! works great. I never seem to look in the right help area for this stuff. Is this kind of thing covered in the class? Im trying to get a req approved to go early in the year If all of your classes aren’t full by the time the red tape clears…

Thanks again though!

Unfortunately, this is an advanced function that wouldn’t show up in our manuals. Since the root container of a window “is a” Java Container, it inherits/extends the methods of a Java Container object, one of which is setComponentZOrder().

docs.oracle.com/javase/6/docs/ap … ainer.html