I have written a program to magnify a portion of an applet using the glass pane of the applet. To do this,I of course use an affine transform to scale the rendered content of the content pane before painting it on the glass pane. However, since mouse events must be scaled inversely by another transform in order to be at the proper location, I must intercept them at the glass pane and transform the coordinates. After doing this, however, I cannot seem to find a way to forward the events to the content pane as it is covered by the glass pane. Initially I tried the Component.dispatchEvent(AWTEvent) method, however this seemed to ignore any events I would attempt to forward. I've had some success manually retrieving the components and calling the methods of each mouseListener and mouseMotionListener, however, these results are buggy at best. Is there a more standard way of sending events to a component?
Try the following:
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(theEvent)
I did not try this myself I I believe it should work. At least as far as I understand this is the UI testing tools use this method.
BTW, how did not implement magnifier? Using Robot?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With