[messages] [Feature Requests] Mouse-Wheel Behavior

bdgza bdegroot at gmail.com
Tue Oct 12 04:34:34 MST 2010

I probably posted in the wrong forum, I'll try here.

I have written some custom sub-classes for my module to change the
mouse-wheel behavior. I understand the default VASSAL is:
mouse-wheel = scrolling vertical
CTRL+mouse-wheel = scrolling horizontal

I changed it for my module to:
mouse-wheel = scrolling vertical
SHIFT+mouse-wheel = scrolling horizontal (the default MacOS X method)
CTRL+mouse-wheel = zoom in/out

Is there any reason why this should not be the standard VASSAL way of
using the mouse-wheel in all modules? Implementing this as standard (at
least in the MacOS X) version will allow my 2-axis scroll-wheel to
scroll horizontal as Logitech picks up the SHIFT+mouse-wheel
automatically. I never even knew about the CTRL+mouse-wheel for
horizontal scrolling until I looked into making these sub-classes, I
simply thought horizontal scrolling in VASSAL was broken.

from my sub-class of AdjustableSpeedScrollPane (parentMap is set in the


viewport.addMouseWheelListener(new MouseWheelListener() {
            public void mouseWheelMoved(MouseWheelEvent e) {
               if (e.getScrollAmount() == 0) return;
               Zoomer mapZoomer = null; 
               if (parentMap != null)
                  mapZoomer =  parentMap.getZoomer();
               if (e.getScrollType() ==
MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                  if ((mapZoomer != null) && (e.isControlDown())) {
                     // zoom
                     int notches = e.getWheelRotation();
                     int amount = e.getScrollAmount();

                     for (int i = 0; i < amount; i++) {
                        if (e.getScrollType() ==
MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                           if (notches < 0) {
                           } else {

                  } else {
                     JScrollBar bar = e.isShiftDown() ?
                           horizontalScrollBar :
                     if (bar == null || !bar.isVisible()) return;

                           bar.getValue() +
                           e.getUnitsToScroll() *

Read this topic online here:

More information about the messages mailing list