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

Similar Messages

  • 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

  • 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!");
     

  • 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

  • How to fire JComboBox itemStateChanged event manually?

    hello:
    I want to know how to fire JComboBox itemStateChanged event manually.
    thank you
    -Daniel

    Call setSelectedIndex or setSelectedItem.

  • 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.

  • How I detect mouse wheel movement?

    I never use this for now, and I want to intercept mouse wheel movement (up or down) for to change animation panels (divs) or to make another actions.
    Is not for a scroll of a large stage or div, it's only for to know when the user use the mouse wheel.
    Example: http://www.protest.eu/nl/dames/
    Thank you.

    Are you looking for this ? it may be done easily with Edge Commons
    http://www.edgedocks.com/content/2013/12/using-parallax-scrolling-animate-single-line-code

  • How to define mouse-over event for a icon

    Hello,
    I have defined a icon for a panel in my plugin. I want that the icon should be changed on mouse over event.
    The code for icon is given below.
    resource PanelList (kDNDListsPaletteResourceID) {
                        // 1st panel in the list
                        kDNDListsPaletteResourceID,                    // Resource ID for this panel (use SDK default rsrc ID)
                        kIBPluginPluginID,                                             // ID of plug-in that owns this panel
              #if CSVER >= 4
                        kIsResizable,
              #else
                        isResizable,
              #endif
                        kIBClientPluginDNDPanelWidgetActionID,          // Action ID to show/hide the panel
                        kIBClientPluginDNDPanelTitleKey,               // Shows up in the Window list.
                        "",                                                           // Alternate menu path of the form "Main:Foo" if you want your palette menu item in a second place
                        0.0,                                                                                     // Alternate Menu position Alternate Menu position for determining menu order
                        kPlusIconPNGIconRsrcID, kIBPluginPluginID,                                                            // Rsrc ID, Plugin ID for a PNG icon resource to use for this palette
                        c_Panel
    Where should I give the resourceID of the other icon?

    Hi
    First change the name from kPlusIconPNGIconRsrcID to kPlusIconPNGIconIRsrcID
    so "I" will indicate that your icon is inactive
    Create another resource id like:
    #define kPlusIconPNGIconIRsrcID 15
    #define kPlusIconPNGIconARsrcID 15
    Define paths to the icons
    resource PNGA(kPlusIconPNGIconIRsrcID) "../res/icons/PLUS_ICO_23_I.png" // Inactive icon
    resource PNGR(kPlusIconPNGIconARsrcID) "../res/icons/PLUS_ICO_23_A.png" // Active icon
    Regards
    Bartek

  • How to deactivate mouse (motion) event coalescing (by EventQueue)?

    Hello everybody,
    I would like to know if it is possible to deactivate the event coalescing for mouse events. I refer to the following method found in "java.awt.EventQueue":
        private boolean coalesceMouseEvent(MouseEvent e) {                            
            EventQueueItem[] cache = ((Component)e.getSource()).eventCache;              
            if (cache == null) {                                                      
                return false;                                                         
            int index = eventToCacheIndex(e);                                         
            if (index != -1 && cache[index] != null) {                                
                cache[index].event = e;                                               
                return true;                                                          
            return false;                                                             
        }                                                                              As I can see, all necessary method for modifiing the EventClass class are private. I did not found any method where I can explicitely deactivate the coalescing of mouse events.
    Other "interesting" methods are:
    - java.awt.EventQueue.coalesceEvent(AWTEvent, int)
    - java.awt.Component.coalesceEvents(AWTEvent, AWTEvent)
    But unfortunately, I did not manage to deactivate it.
    For some background information: I would like to build a drawing panel for a Tablet-PC application to draw with a digitizer/pen on it. As an optimal goal, it should be as smooth as the Windows 7 handwriting panel (don't know the official name). The trivial implementation is not fast enough - drawing quickly produces too few points (round lines with edges). And I think one reason for this is, that some mouse (motion) events get coalesced/skipped while drawing - hence this request for support.
    I'm greateful for any hint you may have
    Thanks a lot!

    if (whatever) {
        // (MouseEvent e)
        e.consume()
    } else  {
        // some usefull, but not EventQeue.push()
    } you can consume Key and Mouse events
    you have to check JComponentHierarchy because each of JComponent have got implemented KeyBindings (e.g. F2 edit JTable cell ...),

  • How to handle mouse click event on up-arrow of JSpinner?

    Hi Everybody,
    I have a JSpinner component holding a date field in it (dd/mm/yyyy). I have handeled keyboard up and down arrow key events for the component and that's working as expected. Now I want to make it work for mouse clicks on the up (UP_ARROW_SUBCOMPONENT) and down arrow (DOWN_ARROW_SUBCOMPONENT) buttons of the component.
    Could somebody guide me how to do it? My investigatoin hints me to use JSpinnerMouseEventData but I am not exactly getting how to get it done.
    Thanks in advance!

    if you just want to add a mouseListener to the spinner's buttons, try this
    (only coded it for the up/next button)
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Testing
      public void buildGUI()
        JSpinner spinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 5));
        spinner.setUI(new javax.swing.plaf.basic.BasicSpinnerUI(){
          protected Component createNextButton()
            Component c = super.createNextButton();
            c.addMouseListener(new MouseAdapter(){
              public void mousePressed(MouseEvent me){
                System.out.println("mousie, going up");
            return c;
        JFrame f = new JFrame();
        f.getContentPane().add(spinner);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to detect mouse click event?

    Hello,
    I would like to have a vi to detect left, right and no mouse click. I mean that in the vi attached, Button2 should be 0 (no click), 1 (left c.) or 2 (right c.) depending on the event occured in i-1. cycle. My vi is the modyfied version of the one found here:
    http://www.ni.com/example/27663/en/
    Sometimes it works fine, but another time nothing happens when I click.
    I think the main problem is with the execution times at the for loop and event structure.
    Could you help me how to deal with the problem?
    Thanks you!
    Attachments:
    mouse1.vi ‏12 KB

    Hi VampireEmpire,
    Your For loop iterates twice. If an event occures during first iteration everything is fine - Button 2 refreshes during second iteration. But what happens when an event occures during second iteration? Does Button 2 have a possibility to refresh? 
    1. Do you see the problem now?
    2. And if you do - do you really need For loop? I would suggest you trying removing it and connecting shift register to the while loop.
    Bluesheep

  • How to get mouse wheel action in my swing application?

    Hi
    In my mouse, i am having mousewheel to support scrolling.With the help of the wheel, i can scroll the pages in IE browser or any other appliction.
    In swing application ,i have scroll bar inside a JFrame.I want to have mousewheel action in my swing application to support scrolling.
    any idea ???
    Thanks

    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.

Maybe you are looking for

  • How do I remove a phone number from iMessage on my Mac?

    I get a new iPhone tomorrow on a completely new number and I wanted to know how I can remove my current number from being used for iMessage on my mac so that when I get my new phone I can set it up

  • Oracle 10g Express Edition E-Mail Capability?

    Hello all, We plan to deploy Express Edition for a project. I wonder is there any limitation on Express Edition to send e-mail with PL/SQL? Would it be a problem? Thanks in advance...

  • Canon EOS 350D .CR2 pics still 'unsupported image format'?

    I was releaved to see updates in Mac OS X (10.4.8) and Aperture 1.5 the other week, hoping it would solve my problem, being able to finally work with my RAW files (.cr2) from the Canon EOS 350D (yes, being in Europe these days). I followed the posts

  • EPub export using just a range of pages from inDesign Book

    I've created an ePub Fixed Layout ebook from inDesign 2014.1. I now want to create a summary book for Apple's iBook store, using pages from multiple chapters. I know the ePub export dialog has an "Export Range" panel in the "General" tab. When you ex

  • Help Document on Query View's (Global & Local)

    Hi, I thied to search SDN for previous posts on this topic but none of them are useful. Is there any SAP Help Doc or any other Help Doc that will explain me difference between Local View & grobal View on a Query and How to Generate Local View and Glo