I’m trying to synchronize the scroll bars between 2 template canvases. I found a few relevant post and got to this point of experimenting however instead of setting the scroll bar position on my template canvas it sets the position of the scroll bar in the designer. When I run a client it sets nothing. It does the same thing if I change the object reference to: “event.source”, “event.source.parent”, “event.source.parent.parent”. All work to set the designer scroll bar position.
Why is it not setting the object of interest?
from javax.swing import SwingUtilities
from javax.swing import JScrollPane
event.source.parent.getComponent(‘Group 1’).getComponent(‘Template Canvas 2’))
scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane, event.source)
Once I get past this basic attempt to set the scroll position, I hope to further develop this to read the position of one template canvas and set the other to the same. The code will live in InternalFrameOpened so that is fires every time the scroll bar is moved similar to this post: