Mouse Wheel

Hi,
I'm trying to use the mousewheel to zoom into my map.
When I work with the mousewheel events, I want to take the
details from the event and calculate the new zoom.
This all goes to pot when I get StackOverflowErrors everytime
I use the mousewheel.
Below is code that duplicates this. If you comment and uncomment
the appropriate code, you'll see that the mousewheel works "fine"
with scrollpanes && bars.
Any advice on what fundamental aspect i'm missing ?
Thanks,
-Tim
=====
import javax.swing.*;
import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;
public class Test extends JFrame implements MouseWheelListener
public static void main(String[] args)
JTextPane editor = new JTextPane();
//JScrollPane myPane = new JScrollPane(editor);
Test frame = new Test();
frame.setSize(200, 200);
frame.getContentPane().add(editor);
//frame.getContentPane().add(myPane);
frame.addMouseWheelListener(frame);
frame.
frame.show();
     public void mouseWheelMoved(MouseWheelEvent e) {
          System.out.println("Zoom into map code goes here");
}

Conclusion:
Add it to the fooComponent.getContentPane().addMouseWheelListener(baaMouseWheelHandler);
import javax.swing.*;
import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;
public class Test extends JFrame implements MouseWheelListener
     public static void main(String[] args)
          JTextPane editor = new JTextPane();
          //JScrollPane myPane = new JScrollPane(editor);
          Test frame = new Test();
          frame.setSize(200, 200);
          frame.getContentPane().add(editor);
          frame.getContentPane().addMouseWheelListener(frame);
          frame.show();
     public void mouseWheelMoved(MouseWheelEvent e) {
          System.out.println("Moo");

Similar Messages

  • How to fire mouse wheel events to parent container?

    Hi,
    When I create a JPanel (let's say jParent) inside a JScrollPane and this JPanel is larger than the current viewport I can use my mouse wheel to scroll the JPanel's containt without coding anything about that.
    But if I add another JPanel-derived component (let's say jChild) to the first JPanel, mouse wheel events are not received by the first JPanel when the mouse is over the new added child JPanel.
    How can I forward child's mouse wheel events to the first JPanel?
    If I use:
    jChild.addMouseWheelListener(jParent)I must implement a mouseWheelMoved() method in jParent that requires some code to work while it was doing it byitself before...
    Thanks in advance for any help :-)
    Regards,
    Lara.

    you have a mouseWheelListener added to jChild?
    if so, in the mouseWheelMoved code include this line
    jParent.dispatchEvent(mouseWheelEvent);//or to the scrollpane

  • How to use Mouse Wheel Events

    Hello Everyone
    I am using Datagrid in my Canvas.
    I use mouse wheel to scroll the datagrid. But in one scroll
    through that wheel make the more than 4 rows to be scroll.
    So Now my requirement is to control the delta value of mouse
    wheel event and how to use that with my datagrid so that i will
    able to scroll one row through mouse wheel scroller.
    Thanks

    please give me some suggestion around it.
    I want to scroll one row of datagrid with per mousewheel
    scroll. I am not getting how to use the scrollMouseWheelMultiplier
    property of the IConfiguration class because i am not able to
    create the object of this class.
    I am using the Flex 3.0 and flash 9 version.
    please help me out around this.

  • How do make the mouse wheel scroll in my Flex app/component instead of the browser?

    Let's say I have a DataGrid or Tree or List component which
    has hundreds of rows. When I place my mouse over the component and
    scroll the mouse wheel, I notice that [most of the time] it scrolls
    the component a little, then starts scrolling the browser window. I
    want it to only scroll the component until it reaches the end of
    the rows. Any thoughts?

    I have confronted the same issue.
    Was anybody able to solve it?
    I think mx.contorols.TextArea seems to do well.

  • How to remap mouse wheel in single application?

    Hello,
    I want to achieve simple thing - control audio in Smplayer using mouse wheel. The tricky part is that I need to control the master volume on my AV receiver because the audio in videos is played as bitstream (DTS/AC3 over SPDIF). I'm able to modify the mouse wheel actions in mplayer but unfortunatelly Smplayer doesn't allow such remapping: http://smplayer.sourceforge.net/forum/v … f=2&t=6077
    I already use xbindkeys with xvkbd for application specific remapping of both keyboard and mouse. I can remap the wheel for Smplayer window but I'm unable to figure out how to make sure the wheel will work for other applications as well - I'm just unable to simulate mouse wheel action for applications other than Smplayer. (Or is there any other way how to not modify the button for other applications?)
    If I try only simulating the wheel, it doesn't work...
    # .xbindkeysrc
    "xdotool click 4"
    m:0x0 + b:4
    # or
    "xvkbd -text "\m4""
    m:0x0 + b:4
    However if I add "sleep 0.2" before xvkbd or xdotool, it works (but this is unacceptable delay for me). Also if I try to simulate wheel on keyboard press, it works even without the sleep.
    Any help or suggestion?

    not really.. sorry
    Kunal Mittal

  • SWF in iFrame - How to get mouse wheel to work

    I have been searching for a solution to this for a few days
    without any luck. I was hoping someone here may have come across
    this problem and know of a solution, or know if it just is not
    possible.
    I have a static page which consists of an iframe, picture and
    a div with some links. The image is an image map and set to load
    all links within the iframe. The flash itself is a 360 degree
    panoramic view with hotspots (links) within the file that also
    point to other pages. My issue is that the mouse wheel scroll is
    supposed to be a zoom in/out feature, which work with the flash
    file and full screen view. However, when the file is loaded within
    the iframe, the scroll wheel on the mouse will only scroll the page
    and will not interact with the flash file at all.
    The problem seems to be with the following browsers (PC):
    Chrome 0.4
    Opera 9.5
    Firefox 3.0
    The zoom works in IE6, although the page does scroll with it.
    When I disabled the page from scrolling (see index2.html) the zoom
    stops working. This is probably due to the code used to disable the
    mouse. I really need to try to get the mouse wheel to zoom in
    FireFox 3 though. The large majority of our visitors are PC users
    with FireFox 3 or IE 7, so these are the two most important
    browsers to have working.
    The pages are still currently under development but examples
    are online here:
    http://www.utoledo.edu/campus/virtualtour/maincampus/index.html
    -Normal page
    http://www.utoledo.edu/campus/virtualtour/maincampus/index2.html
    -Page with scrolling disabled
    Does anyone have any ideas for a possible solution? Thanks
    for taking the time to help.

    As far as I know,there is no facility for detecting mouse scrolling wheel in JDK 1.3.
    Check it in the later releases of JDK.

  • Is there a way to change my mouse wheel's funtion so it will scroll with out

    I'm stuck in habit that's hard to get out of. I started editing in Vegas then moved to Premiere CS3.
    I never use the mouse wheel to scroll frames. I wish it could just zoom in and out of the timeline like it did in Vegas without me having to push alt-scroll wheel.
    I'm might be asking for a lot but is this possible? I just can't break my habit of using just the arrow keys when I want to scroll frame to frame. Even though the alt-scroll has 'clicked' in my brain there's that 10% hesitation. That I know would make me more comfortable.
    Call me weird but is there a solution?

    Josh
    Place the cursor over the Source or the Program Monitor and use the scroll wheel to scroll frames.
    (Your post is not that clear whether you want to scroll frames or zoom the timeline as you mention both)

  • Pressing mouse wheel (or Ctrl + Left Mouse Click) on navigation arrows does not open previous/next page in new tab anymore

    I am using the new Firefox Developer Edition as a stand-alone on Ubuntu, so I can still use the "old" version, too.
    Everything seems to be working fine, as in I am logged in and setup sync. But a few features I got very much used to are no longer working.
    When I click on "About Firefox Developer Edition", it shows these details:
    Firefox Developer Edition 36.0a2 (2014-12-09)
    Firefox Developer Edition is up to date
    You are currently on the aurora update channel.
    In my "old" Firefox, I can:
    1. Click with the mouse wheel on the navigation arrows to open the previous or next page in a new tab.
    2. "right mouse click" on the navigation arrows to see the list of previously visited pages of the current tab, and the ones I visited after the page I am on, if I clicked "back" once or more times. I can then click the mouse wheel or "Ctrl + Left Mouse Button" to open any of the pages in the list in a new tab.
    None of this works in the Developer Edition.

    To clarify, the list of previously or later visited pages does still show up when I right click on the navigation arrows in the Developer Version, but I cannot open any of the links in the list in a new tab with the mouse wheel or "Ctrl + Left Mouse Click".

  • All-in-One Qosmio PX30t - Mouse wheel application interruptions

    hello there ...
    for some reason my mouse wheel has been configured to switch to the start page (tiles).
    I find this convenient while operating the desktop activities but during other applications its a bit irritating. Here are examples of what i mean:
    1. in google's chrome, i use the wheel extensively to open a new tab. now with 8.1 i cant as the wheel action takes me to start page (tiles)
    2. im playing Fable and the block action is set to the mouse wheel (make sense as its the most convenient for such task) but with the defaulted switching behavior .. every time i try to block ..im outta the game to the start page (tiles). I know i could avert this by re-configuring the action to a different button or key, but why not have it as is????
    im not sure of these applications to be the only ones as its my first 8.1 use!
    thanks.

    I'm inclined to agree. At first I thought Toshiba had simply remapped the Middle Mouse Button to bring up the start menu for whatever reason, but from what I can tell the PC actually registers the MMB as the Left Windows Key! Why anyone would think this was a good design idea I have no idea. For me it's just frustrating....
    Anyway, I've so far found 2 ways around this:
    First; using any other mouse, the MMB functions normally. So you could plug a regular USB or wireless mouse in and presto! Problem solved.
    +Of course this is FAR less than ideal. One of the reasons I bought an all in one was for the clean look with matching keyboard and mouse. I don't want to give up a USB port when it already comes with the peripherals built in.+
    The second option (The one I'm currently using) is to use key remapping software. I've remapped the Left Window Key to act as the Middle Mouse Button. Now my mouse functions normally.
    +The problem with this solution is that the Windows Key on the keyboard now also works like a MMB. I remapped the "drop down menu" key to act as the LWIN key to compensate, but this solution is also far from ideal.+
    I think Toshiba should release a firmware (or software??) update that either fixes this issue properly, or at least gives users the option to use the MMB as a MMB.

  • [SOLVED] Chromium updated to 24.0.1312.52 (175374), no mouse wheel

    Just updated Chromium to version 24.0.1312.52 (175374) and the mouse wheel can't scroll anymore, had to install an extension for middle-click to be able to scroll again, anyone else with this problem?
    Last edited by bmanuel (2013-01-11 10:25:24)

    anonymous_user wrote:Have you considering using Chromium's experimental smooth scrolling that can be enabled in chrome://flags?
    I tried, but this should be labeled as a joke, that gives basically very little difference, they should just look at how Firefox implemented it for a good reference

  • My mouse wheel is not resizing text like it's supposed to ... how do I fix this?

    BACKGROUND: I'm getting tired of warnings in Seamonkey about sites no longer supporting it, and am considering switching to firefox (with the add-ons that keep the Mozilla look and feel, instead of trying to pretend it's M$ IE (which I wouldn't touch with a 100000000 foot pole).
    Problem #1: I'm used to my mouse wheel resizing text in a tab,
    but for some reason, I can't find the option to enable this in firefox.
    How do I configure this to work properly? I seem to recall an add-on that fixes this, but can't find it now.
    Problem #2: I had an add-on (back when I first tested firefox), that restored Edit-->Preferences, but it's no longer working. Is there another way to put the Preferences option where I'm used to looking for it?
    Thanks,
    --jim

    iOS: Device not recognized in iTunes for Mac OS X

  • I use a two button mouse with my Mac Book Pro.  It works fine, but after installing Lion, the mouse wheel goes in reverse of what it did (rolling the wheel towards your palm goes up not down the page).  Anyone know how to fix this?

    I use a two button mouse with my Mac Book Pro.  It works fine, but after installing Lion, the mouse wheel goes in reverse of what it did (rolling the wheel towards your palm goes up not down the page).  Anyone know how to fix this?

    First sentence in OPs question:
    I use a two button mouse with my Mac Book Pro
    I guess the track pad settings would look similar to my screen shot?
    Regards,
    Colin R.

  • Flash freezes in Firefox when I scroll the mouse wheel over a drop down list or text field (possibly others as well).

    Whenever I scroll in a drop down menu in Flash in Firefox (for example, I move the mouse wheel just one detent), it just continues scrolling on its own all the way to the bottom of the list and freezes all interaction for about 10 seconds.  It's really bizarre.
    If I start click and dragging things, nothing happens, and then all of the sudden everything catches up and moves.  As an experienced programmer, I can say that it looks like some kind of queuing of keyboard/mouse events with delayed execution.   Has anyone else encountered this issue?
    I found something from 2008 that sounds similar, although I am not using the sIFR they mentioned: sIFR mouse wheel scrolling freeze in Firefox - Stack Overflow
    Seems to be a Firefox-specific issue, although it also seems to be something that has just recently started occurring since updating Firefox.
    UPDATE:  I was checking my Firefox version in Help > About Firefox, and it showed version 33, but also had a pending update so I restarted Firefox.  The problem was no longer occurring at that point.  When I checked the version again, it said 33.0.2, but it also said "applying update", with another pending restart. I restarted Firefox again.  It's now stable at version 33.1.  So perhaps it was a problem with that particular version, or even a temporary issue with that running browser instance.

    Hi James,
    Thank you for sharing your solution with us. It will help other users with a similar issue.
    Thanks,
    Preran

  • Mouse Wheel  under Windows XP Does not work- 9.0.3

    I use Windows XP and JDeveloper9.02 handled mouse wheel scrolling reasonably well(help files could not be scrolled). I can not use the mouse wheel in the Jdeveloper9.03 editor or the help files. Am I missing something? I thought JDeveloper9.03 added mouse wheel capability as its new release feature.
    I know user's of windows 98 had problem with mouse wheel. However, migrating to JDeveloper9.03 seems to have fixed the mouse wheel problem for Windows98 users and made it a problem for WindowsXP users!

    I work with Ramin. Both he and I just unzipped JDev903 to a new folder (C:\Program Files\OracleJDeveloper903). There was no mention in the readme file about having to uninstall the prior version, and since it didn't have a Windows installer (the files are merely unzipped), we didn't think that it mattered that another version was on disk. He was running only the 903 version -- the 902 version was simply on the disk just like dozens of other programs are on the disk. I don't believe he rebooted after exiting 902 and unzipping 903, if that matters. So I think what he did was
    1) run 902
    2) quit 902
    3) unzip 903 to new folder
    4) run 903 and notice mouse doesn't work
    Questions: Do you recommend getting rid of 902 totally off your disk? If not, do you recommend installing it to the same folder or a different folder? What about rebooting in-between running/quitting 902 and running 903?
    (FYI: By the way, I unzipped it and then tried to open up one of my existing workspaces. I found I couldn't browse up the the root folder. It said "I/O Error: The dir c:\ is not accessible. Please select a different directory." It had me in the c:\Program Files\OracleJDeveloper903 folder and I wanted to go to c:\My Documents. I couldn't browse there because I needed to pass through the root to get there. The workaround was to type in c:\My Documents into the File field. However I'm using Win98 but I plan on going to Win2000. Perhaps that will fix the root problem. My mouse works now in win98 but I hope I don't lose that functionality when I go to 2000.)

  • Why does my mouse wheel only scroll up in the catalog.  It works correctly in every other program.

    When in a catalog folder and showing a single picture, the mouse wheel only scrolls up, not down.  This behavior is not seen in any program other than elements.  If more than one line of pictures is showing in the window, it works fine, both up and down scrolling.

    Hi All,
    Please refer to the following article and do the needful:
    Photoshop Elements Help | Photoshop Elements hotfix 13.1.1
    It should solve the scrolling issue.
    Thanks,
    Anwesha

  • Cant scroll horizontally with mouse wheel in FF

    I cant scroll horizontally in FF unter XP+SP3 by pressing the mouse wheel sideways. This is the same in FF 3.6 and 4.0 beta, while in IE 6.0 and in other MS programs (Explorer, Word, ...) it works fine. I am having this problem with 2 different mice: Fujitsu 400NB and easytouch ET-9600. I cant find newer drivers for them than what I have installed from the CDs. Here some settings from my FF: mousewheel.horizscroll.withnokey.action;0 mousewheel.horizscroll.withnokey.numlines;1 mousewheel.horizscroll.withnokey.sysnumlines;true. Some time ago I played around with them but that didn't help. What else can I do to get FF scrolling horizontally?

    This should get you there
    http://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/
    1. Load the mousewheel min script via CDN (jquery-mousewheel - cdnjs.com - the missing cdn for javascript and css)  into the Scripts Panel;
    2. Add the provided snippet into your Stage > compositionReady event handler.
    hth
    Darrell

Maybe you are looking for

  • How do I rename the PDF (both Title & Author) in new ibooks for Mavericks?

    Hi! I can't seem to amend both Title and Author for my PDFs in the new ibooks App in Mavericks. (Opening it in Preview and renaming it does not change the Author name FYI) The current solutions present are for 2013 and there is none for the new app i

  • No longer able to watch TV/video?

    I have the 30GB Video iPod. Originally I had it on my Dell laptop. At that point I was able to download and watch LOST. A year ago, I purchased an iMac and transferred my iTunes. I went to download a new television program (first time since the Mac)

  • Everytime I try to search the itunes store it locks up my computer.

    When I use the search bar in iTunes to search the iTunes Store it crashes the application. If I use the Power Search option the search works fine and does not crash iTunes. This is a Windows 7 64-bit workstation using the 64-bit version of iTunes and

  • Problems creating Struts ActionForm in JDeveloper 9.0.3.3

    I am very new to JDeveloper, where recently i am learning on how to use the struts technology. The problem occurs when i right-click the project file at the navigator and i choose NEW then at the Web-Tier i choose Struts, and at the item columns i ch

  • Can a 9.2.0 plug-in be used in Acrobat X Pro ?

    A corporate update will install Acrobat X pro and we are currently using Acrobat 9.2 . All is well and functioning . I have the following Questions :       1. Will a 9.2 plug-in work with X ?           The current plug-in is compiled using version 1