File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

implement MouseWheelListener to Zoom-In Zoom-out a document on document frame

 
Katherine Dhiman
Greenhorn
Posts: 4
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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...

Can anyone please help me out with this?
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which component are you going to apply zoom to?

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.).
 
Katherine Dhiman
Greenhorn
Posts: 4
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try the above..thank you

I need to implement the zoom to a dumentFrame

 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Katherine Dhiman
Greenhorn
Posts: 4
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I'll just try with code you provided earlier..
thank you
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any time, feel free to ask if you come to an issue so we can try to resolve it.

And welcome to the Ranch!
 
Katherine Dhiman
Greenhorn
Posts: 4
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
(bow)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic