JWindow blocking mouse wheel event?

I have created a custom JPanel that acts as a container for another custom component that needs to receive mouse wheel events. When I place the custom JPanel in a JWindow the mouse wheel events do not get invoked, all though other mouse events work just fine. If I place the JPanel in a JFrame the mouse wheel events are invoked just fine (along with other mouse events).
To keep things simple the JPanel handles the mouse listeners. Any idea why it would work when in a JFrame but not a JWindow?
Edited by: skip1899 on Sep 21, 2009 7:20 AM

The below sample code exhibits the behavior I am talking about on my system (1.6.0_16 on XP). Does it work for you? Is there something I am missing?
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javax.swing.JFrame;
import javax.swing.JWindow;
public class TestWindow extends JWindow implements
   MouseWheelListener,MouseListener {
     public TestWindow() {
          setSize(200,200);
          addMouseWheelListener(this);
          addMouseListener(this);
  public static void main(String args[]) {
       JFrame  frame = new JFrame();
       frame.setSize(300,300);
       frame.setVisible(true);
       TestWindow win = new TestWindow();
       win.setVisible(true);
public void mouseWheelMoved(MouseWheelEvent e) {
     System.out.println("Mouse Wheel Moved!");
public void mouseClicked(MouseEvent arg0) {
     System.out.println("Mouse Clicked!");
public void mouseEntered(MouseEvent arg0) {
     System.out.println("Mouse Entered!");
public void mouseExited(MouseEvent arg0) {
     System.out.println("Mouse Exited!");     
public void mousePressed(MouseEvent arg0) {
     System.out.println("Mouse Pressed!");     
public void mouseReleased(MouseEvent arg0) {
     System.out.println("Mouse Release!");
 

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.

  • Mouse wheel event coordinates issue in LV2013

    I realized some unexpected behavior when using the mouse wheel event of an XYGraph:
    The event contains the mouse coordinates which should be relative to the origin of the pane according to the LabVIEW help (see Mouse Wheel (Control Event)). In my case these coordinates are shifted. At the same time, the coordinates returned by the Mouse Move and Mouse Down events are correct. I think the Mouse Move, Mouse Down and Mouse Wheel Event coords should all be the same, i.e. relative to the owning pane's origin? The graph is in a window divided by splitters. I am using LabVIEW 2013 Professional Development System.

    Hi maxicon,
    I tried to reproduce your described behavior - It works as expected (see the attached VI).
    Please try to reproduce the issue again with the attached VI.
    1. Move the mouse and see coords changing.
    2. Operate the mouse wheel and see the coords are the same.
    P.S. Zero-coordinates are marked in the frontpanel:
    Kind regards,
    Heinz
    Attachments:
    Mouse Wheel Coords.vi ‏10 KB

  • Mouse wheel events are being caught by Photoshop document

    I'm using CSXSWindowedApplication.
    If you create any document in Photoshop, then zoom into it, so it takes more space than visible screen area and then open a CS Extension panel - the mouse wheel event is being caught by Photoshop and when you're rolling it, Photoshop moves document up and down, instead. mouseWheel events don't reach neither WindowedApplication nor any control inside of it.
    This only happens in Photoshop.
    Are there any workarounds?
    Thank you!

    Interesting. I've' not played with mouse wheel events. I'll have a look at it.
    Thanks
    Bob

  • Mouse wheel events aren't caught in browser

    Hello.
    I developed an applet with NetBeans 6.5 with mouse wheel zooming. In applet viewer everything works fine, but when I start applet in page in browser (I tried Firefox 3.0.6, MS IE 6.0, MS IE 7.0), no mouse wheel events (neither scrolling) are caught by applet.
    Any ideas?
    Thanks.

    The reason behind this is: When applet is run on web browser, the applet window does not get focus. If you can grab the focus somehow, mouse wheel events will work fine. However, this works fine in applet viewer and in older versions of JDK. This is broken in JDK 1.6 and already fixed in JDK 1.7. Please have a look into this bug:
    [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516675|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516675]
    If you run following applet in your browser you will see mouse wheel events in action with JDK1.6:
    [In case it does not work, click on 'Click Me' button and try]
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    * @author mrityunjoy_saha
    public class TestApplet extends JApplet {
        public void init() {
             setLayout(new BorderLayout());
            XPane xPane = new XPane();
            //xPane.requestFocus();
            JScrollPane pane = new JScrollPane(xPane);
            //add(new JButton("Click Me"), BorderLayout.NORTH);
            add(pane, BorderLayout.CENTER);
        class XPane extends JPanel {
         private JLabel jLabel1;
            public XPane() {
                jLabel1 = new javax.swing.JLabel();
                addMouseWheelListener(new java.awt.event.MouseWheelListener() {
                    public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
                        formMouseWheelMoved(evt);
                jLabel1.setText("Mouse Wheel Info...");
                   add(jLabel1);
            private void formMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
                jLabel1.setText(String.valueOf(evt.paramString()));
    }Thanks,
    Mrityunjoy

  • JScrollPane - Set the rate of the mouse wheel for scrolling

    Hi,
    I'm curious to know a little more about the mouse wheel used for scrolling in a JScrollPane. I'm using it for a JTextComponent at the moment, but the scroll rate is really slow.
    Is this because of the way swing deals with the mouse wheel, and therefore can I increase the rate of scroll?
    Or is it to do with the native OS and the way it processes mouse wheel events?
    Cheers,
    David

    Hey John,
    Scroll rate has nothing to do with the OS you'll be glad to know. As far as Swing goes, it doesn't in this case make any assumptions on how you want you 'views' to scroll.
    I think LookAndFeel implementations often decide on default behaviour - I suppose this is in essence the whole point of the pluggable LnF framework.
    Anyway, JTextComponent is an abstract class so I would not be surprised if it performs like a lame duck! You will however notice that it implements the Scrollable interface. Take a look at Scrollable.getScrollableBlockIncrement() and Scrollable.getScrollableUnitIncrement().
    Overriding these methods will give you the behaviour you desire.
    Warm regards,
    Darren B

  • MapViewer mouse wheel support?

    Hi all,
    I'd like to know whether MapViewer has javascript support for mouse wheel events. I would like to implement mouse wheel zooming however the api does not have an "onMouseWheel" event for a MVMapView component. Another way to do this would be to add mouse wheel support to the page, and then use "onMouseOver" and "onMouseOut" events to determine whether the cursor is over the map or not, however these events also don't seem to be supported. Any ideas would be much appreciated. Thanks.

    As it turns out their is inbuilt support for mouse wheel zooming but for some reason it doesn't appear to be included in the supplied java API documentation. This command is all that is required: mapview.setMouseWheelZoomEnabled(true)

  • Mouse wheel capture

    Why is it that some Flash plug-ins eat up the mouse wheel
    events and some don't.
    By eat it up I mean taking the event from the browser and
    processing it itself.
    Example of plug-ins that do eat up the mouse wheel:
    http://www.mediacollege.com/flash/media-player/720x360/demo.html
    http://www.swffix.org/swfobject/testsuite/test_com.html
    Example of plug-ins that don't eat up the mouse wheel:
    http://flowplayer.org/
    http://www.swffix.org/swfobject/testsuite/test_api_createswf.html
    I have not been able to find any reason why these two differ
    and how. Please help.
    Thanks!

    >>
    http://www.swffix.org/swfobject/testsuite/test_com.html
    The page isn't long enough to scroll so the mosue wheel
    wouldn't do anything
    anyway.
    >>
    http://www.mediacollege.com/flash/media-player/720x360/demo.html
    That has a mouse-wheel scrollable component, used to display
    the files on
    the left - that is likely capturing the event.
    And on any of them, simply clicking outside the Flash, to
    give the page the
    focus, will allow the mouse wheel to work as you expect.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Remmina not transmitting mouse wheel to VNC session

    Hi,
    I have just noticed that remmina is not transmitting mouse wheel events to VNC session. Never tried RDP, so I don't know if this is also affected.
    First question: Is it only on my system or a general problem on Arch ?
    If it is a general problem on Arch ...
    I did a bit research abot this subject area, and I found some bug reports in multiple distros, but they are all marked as solved. So I think that it is fixed upstream. Otherwise the distros could not mark it as solved, right ?
    If the package maintainer should read this ... is there a plan to update this package in near future ?
    Thanks and Regards,
    Markus

    Usability bugs. The most annoying one was the size of the remmina window that was "never" right. And clicking the "1" button (top left) did unpredictable things. In most cases the window was maximised to full screen height leaving black bars above and below. The bug seems to appear less and less. I promise I will file a bug when I experience it again :-)
    Crashes were always rare in my case.
    But here's not the right place to lament around.

  • HSlider and mouse wheel

    I'm using Flex 4 and I've noticed something annoying with the spark HSlider: if I click the slider, it seems to retain focus so that even if the mouse is not over it, moving the mouse wheel up or down still causes the slider to move left or right.
    I'd actually prefer that my slider not respond to mouse wheel events at all, but preventDefault() doesn't seem to work in this case. How can I get an HSlider to ignore mouse wheel events???
    Thanks,
    Rob

    Sublcass HSlider and include this code
    override protected function system_mouseWheelHandler(event:MouseEvent):void
                // DO NOT DELETE THIS FUNCTION
                // leave blank to remove wheel scrolling on sliders

  • Change the amout a scroll bar moves when user uses the mouse wheel?

    hi,
    i have a JScrollPane, and when a user uses the "wheel" on the mouse, it seems to move up/down 1 line at a time...i would like it to scroll faster basically...so that when the "wheel", the scroll bars move up/down like 5 lines at a time....is there some way to set this value, or how can i do it?
    thanks

    It looks like it behaves just like if the user had clicked the up or down arrow on the scrollbar, so
    I would suggest setting the unit increment on the vertical scroll bar to be 5X its current value. Of
    course, this would also increase the amount that gets scrolled when the user clicks on the up
    or down arrow. If you don't want that, you'd need to somehow only change the increment on a
    mouse wheel event, do the scroll, then change it back. My guess is that you'll need to provide
    your own look and feel class to do that.
    : jay

  • Mouse Wheel on Safari

    I'm trying to handle mouse wheel event, it works on IE &
    FF, but I see that nothing work under safari.
    Any suggestions?

    I'd start by suggesting you ask in the Windows Compatibility or Safari forums. This is the iPad in the Enterprise forum.
    Regards.

  • Why I can not scroll menu drop down via mouse wheel to pick an option that is not visible?

    I am using FF 22.0 on Windows 8. When I start scrolling on drop down menu which show the vertical scroll bar via mouse wheel event on my touch pad when the cursor is on the menu area, Firefox just close the menu. I don't install any add on related to mouse/touch event.
    Toggling Use autoscrolling, Use smooth scrolling, or Use hardware acceleration has no effect.
    This error behavior is not happening in IE 10. I just want some clarification whether this is a bug or I just failed to find some configurations that fix it.

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * You can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • Bug? Mouse wheel doesn't work on Firefox and Chrome when added an application skin

    I added a customized skin to make the background of Flex to transparent. The skin is created by the "new file wizard" and only changed the "backgroundRect" 's alpha to "0".
    It works with no problem in IE8.0.6001 and Opera11.6 but doesn't respond to any mouse wheel event in FireFox 11.0 and Google Chrome 17.0.963.79.
    Is it a BUG?
    The flash player's versions are: IE:11.1.102.55; FireFox:11.1.102.55; Chrome:11.1.102.63; Opera:11.1.102.55

    I opened a new Flex project and then tried again. I finally found that it's not a problem of flash but div rendering.
    It seems Firefox and Chorme don't pass mouse wheel event automatically if div layout is set to "absolute".
    Although this is not a Flex issue, any idea of passing that event to flash will be appriciated. I haven't find a way to do it so far :-(
    What I'm doing is editing the "index.tamplate.html" to test. I added a div to contain the div of "flashContent" and set it's style to:
        position: absolute;
        top: 150px; left: 150px;
        height: 250px; width: 250px;
        z-index: 10;
    Another div's z-index is set to 1 to test the overlay effect.
    The reason why I added a div to contain the original div of flash, is I cannot figure out a way to effectively edit the CSS of the "flashContent" div.
    Any help will be thankful!!

Maybe you are looking for

  • Need to upgrade from 10.1.5 to tiger, don't have dvd drive

    I only have a cd drive in my old imac. Would like to upgrade to Tiger and add an airport card. Do I need to buy the full version or just an upgrade cd? Is it possible to put an airport card in this imac? Should I add more memory too? I hear it is pre

  • How to restore OS X on Power Mac G4?

    A few days ago I installed OS X Tiger, and it booted fine a few times, aside from telling me I need to restart time after time. But it got to a point where it wouldn't load the HDD or a restore disc. So, I completely cleared the hard drive, and I can

  • No one wants my Performance Tuning experience?

    I worked as a DBA for 2 years in IT major where my work was confined to Performance Tuning & monitoring and so I had no opportunity to get the experience of Backup & Recovery,RMAN and other Core DBA responsibilities. I had to leave in July last year

  • ARCHIVELOG DELETION POLICY 10g?

    I know in 11g, we have this command. RMAN>CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 3 TIMES TO DEVICE TYPE sbt; is there a similar command in 10g as well for this feature?

  • Delete JDBC Asynchronoues Messages from Communication Channel

    Hello everybody, I have a lot of messages that I can see in the coomunication channle monitoring of a JDBC Receiver, now this messages are asynchronous tha channel was stopped, now the thing is that I need to Start the communcation channel but I need