Results 1 to 6 of 6

Thread: Detecting end of mouse wheel

  1. #1
    Join Date
    Dec 2009
    Posts
    292

    Detecting end of mouse wheel

    Hello,
    In my applet, I add support for the mouse wheel. My problem is that when there is action on the wheel, I run a function and as part of this treatment is long. So I would execute this section only when the user has finished "playing" with the wheel while running the reset mouseWheelMoved each. Briefly I want to detect the mouse wheel when it reaches at the end of movement. How can I do this? How to set up a Boolean that proves that the user has finished manipulating the wheel?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Detecting end of mouse wheel

    Hello,
    I do not know if it will respond to your question but if you look at the argument that mouseWheelMoved is mouseWheelEvent, as he getScrollAmount method (), so you can run for each "ScrollAmount" your function for small amount movies, and once you're reached the end, the movement will be stopped. I do not know if this is what you are asking or my logic towards it is correct, but your question if difficult to answer.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Detecting end of mouse wheel

    Hello,
    I do not think there is the concept of "end of scroll" in java. It just means that you have not scrolled for some time. I say it must manage a timer:
    - Each scroll you reset (say, for 1 second )
    - If you spent one second without reset (so when you no longer have scrolled past second), you make your function long.
    Advantage: it forces you to put your long-acting in another thread that Swing, which will not freeze your display.

  4. #4
    Join Date
    Dec 2009
    Posts
    292

    Re: Detecting end of mouse wheel

    Hello,
    Thank you to you both. I thought something like this but I would love another way round it. If you have any other alternative to this method, then please post that method and the way to use it. My problem is that when each step of the wheel mouseWheelMoved event is launched I want to capture the action. Do you have any solution for this.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Detecting end of mouse wheel

    Hello,
    You may try to create an attribute to your class that you upgrade to each call mouseWheelMoved representing the number of loops you have to do in another function and after this loop. Are you sure he does not "factored" no calls mouseWheelMoved so many notches wheel are made in a short time? Otherwise, actually, my method does not work but in this case I do not see what is their method getScrollAmount if the event is launched at every step of wheel for this function, as I understand, will always return 1. Try to test how it returns every time.

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Detecting end of mouse wheel

    Hello,
    This would be what you are looking for.
    Code:
    java. awt. event. MouseWheelEvent
    
    public i getWheelRotation ()
    
    Returns the mouse wheel rotations.
    negative values if the mouse wheel was rotated up / away from the user, and positive values if the mouse wheel was rotated down / towards the user.

Similar Threads

  1. Mouse Wheel doesn’t work in VB6 on windows 7
    By Elazar in forum Operating Systems
    Replies: 5
    Last Post: 08-01-2012, 10:59 AM
  2. Mouse Scroll Wheel Not Working In Word
    By m3pilot in forum MS Office Support
    Replies: 6
    Last Post: 16-05-2011, 01:56 PM
  3. Disable Mouse Scroll Wheel
    By Raffaele in forum Operating Systems
    Replies: 2
    Last Post: 12-02-2009, 05:41 PM
  4. Mouse Scroll Wheel ignored by Office 2007
    By Indragop in forum Office Setup
    Replies: 5
    Last Post: 19-09-2008, 12:21 PM
  5. Wheel mouse moves downwards
    By Pyrotechnic in forum Hardware Peripherals
    Replies: 2
    Last Post: 07-08-2008, 05:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,111,718.75165 seconds with 17 queries