int unitIncr = scrollComp.getScrollableUnitIncrement(viewRect, orientation, direction); if (orientation == SwingConstants.VERTICAL) {
@Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return getScrollable(orientation).getScrollableUnitIncrement( visibleRect, orientation, direction); }
if (c instanceof Scrollable) { Scrollable s = (Scrollable) c; i.left = s.getScrollableUnitIncrement(visible, SwingConstants.HORIZONTAL, 1); i.top = s.getScrollableUnitIncrement(visible, SwingConstants.VERTICAL, 1); i.right = s.getScrollableUnitIncrement(visible, SwingConstants.HORIZONTAL, -1); i.bottom = s.getScrollableUnitIncrement(visible, SwingConstants.VERTICAL, -1);
if (c instanceof Scrollable) { Scrollable s = (Scrollable) c; i.left = s.getScrollableUnitIncrement(visible, SwingConstants.HORIZONTAL, 1); i.top = s.getScrollableUnitIncrement(visible, SwingConstants.VERTICAL, 1); i.right = s.getScrollableUnitIncrement(visible, SwingConstants.HORIZONTAL, -1); i.bottom = s.getScrollableUnitIncrement(visible, SwingConstants.VERTICAL, -1);
if (pos.y < inner.y) { int dy = s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, 1); Rectangle r = new Rectangle(inner.x, outer.y - dy, inner.width, dy); c.scrollRectToVisible(r); } else if (pos.y > (inner.y + inner.height)) { int dy = s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, -1); Rectangle r = new Rectangle(inner.x, outer.y + outer.height, inner.width, dy); c.scrollRectToVisible(r); int dx = s.getScrollableUnitIncrement(outer, SwingConstants.HORIZONTAL, 1); Rectangle r = new Rectangle(outer.x - dx, inner.y, dx, inner.height); c.scrollRectToVisible(r); } else if (pos.x > (inner.x + inner.width)) { int dx = s.getScrollableUnitIncrement(outer, SwingConstants.HORIZONTAL, -1); Rectangle r = new Rectangle(outer.x + outer.width, inner.y, dx, inner.height); c.scrollRectToVisible(r);
if (pos.y < inner.y) { int dy = s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, 1); Rectangle r = new Rectangle(inner.x, outer.y - dy, inner.width, dy); c.scrollRectToVisible(r); } else if (pos.y > (inner.y + inner.height)) { int dy = s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, -1); Rectangle r = new Rectangle(inner.x, outer.y + outer.height, inner.width, dy); c.scrollRectToVisible(r); int dx = s.getScrollableUnitIncrement(outer, SwingConstants.HORIZONTAL, 1); Rectangle r = new Rectangle(outer.x - dx, inner.y, dx, inner.height); c.scrollRectToVisible(r); } else if (pos.x > (inner.x + inner.width)) { int dx = s.getScrollableUnitIncrement(outer, SwingConstants.HORIZONTAL, -1); Rectangle r = new Rectangle(outer.x + outer.width, inner.y, dx, inner.height); c.scrollRectToVisible(r);
s.getScrollableUnitIncrement(visible, SwingConstants.HORIZONTAL, 1); i.top= s.getScrollableUnitIncrement(visible, SwingConstants.VERTICAL, 1); i.right= s.getScrollableUnitIncrement( visible, SwingConstants.HORIZONTAL, -1); i.bottom= s.getScrollableUnitIncrement(visible, SwingConstants.VERTICAL, -1);
Scrollable s = (Scrollable) c; i.left = s.getScrollableUnitIncrement( visible, SwingConstants.HORIZONTAL, 1); i.top = s.getScrollableUnitIncrement( visible, SwingConstants.VERTICAL, 1); i.right = s.getScrollableUnitIncrement( visible, SwingConstants.HORIZONTAL, -1); i.bottom = s.getScrollableUnitIncrement( visible, SwingConstants.VERTICAL,
s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, 1); Rectangle r= new Rectangle(inner.x, outer.y - dy, inner.width, dy); c.scrollRectToVisible(r); s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, -1); Rectangle r= new Rectangle(inner.x, outer.y + outer.height, inner.width, dy); s.getScrollableUnitIncrement( outer, SwingConstants.HORIZONTAL, s.getScrollableUnitIncrement( outer, SwingConstants.HORIZONTAL,
/** * Components that display logical rows or columns should compute * the scroll increment that will completely expose one new row * or column, depending on the value of orientation. Ideally, * components should handle a partially exposed row or column by * returning the distance required to completely expose the item. * <p/> * Scrolling containers, like JScrollPane, will use this method * each time the user requests a unit scroll. * * @return The "unit" increment for scrolling in the specified direction. * This value should always be positive. * @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int) */ public int getScrollableUnitIncrement(JXLayer<? extends V> l, Rectangle visibleRect, int orientation, int direction) { if (l.getView() instanceof Scrollable) { return ((Scrollable) l.getView()).getScrollableUnitIncrement( visibleRect, orientation, direction); } return 1; } }
amount = ((Scrollable)view).getScrollableUnitIncrement (visRect, orientation, direction);
amount = ((Scrollable) view).getScrollableBlockIncrement(visRect, orientation, direction); } else { amount = ((Scrollable) view).getScrollableUnitIncrement(visRect, orientation, direction);
if (position.y < inner.y) { int dy = s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, -1); Rectangle r = new Rectangle(inner.x, outer.y - dy, inner.width, dy); component.scrollRectToVisible(r); } else if (position.y > (inner.y + inner.height)) { int dy = s.getScrollableUnitIncrement(outer, SwingConstants.VERTICAL, 1); Rectangle r = new Rectangle(inner.x, outer.y + outer.height, inner.width, dy); component.scrollRectToVisible(r); int dx = s.getScrollableUnitIncrement(outer, SwingConstants.HORIZONTAL, -1); Rectangle r = new Rectangle(outer.x - dx, inner.y, dx, inner.height); component.scrollRectToVisible(r); } else if (position.x > (inner.x + inner.width)) { int dx = s.getScrollableUnitIncrement(outer, SwingConstants.HORIZONTAL, 1); Rectangle r = new Rectangle(outer.x + outer.width, inner.y, dx, inner.height); component.scrollRectToVisible(r);
public int getUnitIncrement(int direction) { JViewport vp = getViewport(); if (!unitIncrementSet && (vp != null) && (vp.getView() instanceof Scrollable)) { Scrollable view = (Scrollable) (vp.getView()); Rectangle vr = vp.getViewRect(); return view.getScrollableUnitIncrement(vr, getOrientation(), direction); } else { return super.getUnitIncrement(direction); } }
Scrollable view = (Scrollable) (vp.getView()); Rectangle vr = vp.getViewRect(); p.y -= view.getScrollableUnitIncrement(vr, SwingConstants.VERTICAL, -1); Scrollable view = (Scrollable) (vp.getView()); Rectangle vr = vp.getViewRect(); p.y += view.getScrollableUnitIncrement(vr, SwingConstants.VERTICAL, 1); Scrollable view = (Scrollable) (vp.getView()); Rectangle vr = vp.getViewRect(); p.x -= view.getScrollableUnitIncrement(vr, SwingConstants.HORIZONTAL, -1); Scrollable view = (Scrollable) (vp.getView()); Rectangle vr = vp.getViewRect(); p.x += view.getScrollableUnitIncrement(vr, SwingConstants.HORIZONTAL, 1);
int unitIncr = scrollComp.getScrollableUnitIncrement(viewRect, orientation, direction);
int unitIncr = scrollComp.getScrollableUnitIncrement( viewRect, orientation, direction);