Reputation: 31
I am trying to code something where I can pan around and zoom a graphic, but I can't figure out how to get zoom quantity. I am working in a swing UI and I have successfully gotten scrolling to work for both sideways and vertical scrolling using a MouseWheelListener in my JFrame, however the mouseWheelListener isn't detecting zooming. I'm looking for either a way to acquire zoom events from a mouseWheelListener or for a library that can give me zoom events.
I've seen a bunch of people use the MouseWheelEvent.isControlDown()
method, however when I try that I don't get any updates, even while zooming.
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.isControlDown()) {
System.out.println("zooming");
}
}
I am on a mac laptop and I've tried searching for the mouse or key equivalent of zooming to no avail. I've also tried System preferences > Accesibility > Zoom > "Use scroll gesture with modifier keys to zoom" set to on and "Modifier key for scroll gesture" set to control, but this didn't work either.
Upvotes: 0
Views: 28