if (scrollpane.getViewport().getComponentCount() == 0) return;  Component target = scrollpane.getViewport().getComponent(0); JScrollBar bar = scrollpane.getVerticalScrollBar(); Scrollable scrollable = (target instanceof Scrollable) ? (Scrollable) target : null;  boolean tracksHeight = scrollable != null && scrollable.getScrollableTracksViewportHeight(); int wheel = e.getWheelRotation() * ROWS_PER_WHEEL_CLICK; int delta;   if (bar != null && ! tracksHeight) { if (scrollable != null) { bounds(target); delta = scrollable.getScrollableUnitIncrement( rect, SwingConstants.VERTICAL, wheel); } else {  delta = wheel * SCROLL_NON_SCROLLABLES; } scroll(bar, delta); }  else { bar = scrollpane.getHorizontalScrollBar(); boolean tracksWidth = scrollable != null && scrollable.getScrollableTracksViewportWidth();  if (bar != null && ! tracksWidth) { if (scrollable != null) { bounds(target); delta = scrollable.getScrollableUnitIncrement( rect, SwingConstants.HORIZONTAL, wheel); } else {  delta = wheel * SCROLL_NON_SCROLLABLES; } scroll(bar, delta); } }
    public void mouseWheelMoved(MouseWheelEvent event)    {      // TODO: Implement this properly.    }