This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I'm trying to implement a MouseListener that listens the mouse wheel and according to the number of notches recorded zooms-in or out of the document on the documentFrame.
i'm not geting how to code to actually capture the scroll of the wheel...
Also, I want to implement this with ctrl key...so ctrl+scroll in zooms in..n likewise..
so VK_mouseWheelScroll maybe...something similar to that...
To listen for mouse scroll for zooming, you should have something like this:
Note that if you are working with graphics and want to add this functionality to canvas of some kind that you defined for displaying content, the best approach is to define finite state automata for manipulating actions user can perform on it (zoom, select, move, etc.).
The quieter you are, the more you are able to hear.
That's not standard Java class, so I can't give you any more details. But I see from the API (if I'm looking at the right one) that it extends JComponent, so I think the steps I gave you will do the job.