void scroll(int x,int y,int flag,int type){
  checkSecurity();
  ScrollPane sp=(ScrollPane)target;
  Component c=getScrollChild();
  if (c == null) {
    return;
  }
  int sx, sy;
  Color colors[]=getGUIcolors();
  if (sp.getScrollbarDisplayPolicy() == ScrollPane.SCROLLBARS_NEVER) {
    sx=-x;
    sy=-y;
  }
 else {
    Point p=c.location();
    sx=p.x;
    sy=p.y;
    if ((flag & HORIZONTAL) != 0) {
      hsb.setValue(Math.min(x,hsb.getMaximum() - hsb.getVisibleAmount()));
      ScrollPaneAdjustable hadj=(ScrollPaneAdjustable)sp.getHAdjustable();
      setAdjustableValue(hadj,hsb.getValue(),type);
      sx=-(hsb.getValue());
      Graphics g=getGraphics();
      if (g != null) {
        try {
          paintHorScrollbar(g,colors,true);
        }
  finally {
          g.dispose();
        }
      }
    }
    if ((flag & VERTICAL) != 0) {
      vsb.setValue(Math.min(y,vsb.getMaximum() - vsb.getVisibleAmount()));
      ScrollPaneAdjustable vadj=(ScrollPaneAdjustable)sp.getVAdjustable();
      setAdjustableValue(vadj,vsb.getValue(),type);
      sy=-(vsb.getValue());
      Graphics g=getGraphics();
      if (g != null) {
        try {
          paintVerScrollbar(g,colors,true);
        }
  finally {
          g.dispose();
        }
      }
    }
  }
  c.move(sx,sy);
}

void scroll ( int x , int y , int flag , int type ) { checkSecurity ( ) ; ScrollPane sp = ( ScrollPane ) target ; Component c = getScrollChild ( ) ; if ( c == null ) { return ; } int sx , sy ; Color colors [ ] = getGUIcolors ( ) ; if ( sp . getScrollbarDisplayPolicy ( ) == ScrollPane . SCROLLBARS_NEVER ) { sx = - x ; sy = - y ; } else { Point p = c . location ( ) ; sx = p . x ; sy = p . y ; if ( ( flag & HORIZONTAL ) != 0 ) { hsb . setValue ( Math . min ( x , hsb . getMaximum ( ) - hsb . getVisibleAmount ( ) ) ) ; ScrollPaneAdjustable hadj = ( ScrollPaneAdjustable ) sp . getHAdjustable ( ) ; setAdjustableValue ( hadj , hsb . getValue ( ) , type ) ; sx = - ( hsb . getValue ( ) ) ; Graphics g = getGraphics ( ) ; if ( g != null ) { try { paintHorScrollbar ( g , colors , true ) ; } finally { g . dispose ( ) ; } } } if ( ( flag & VERTICAL ) != 0 ) { vsb . setValue ( Math . min ( y , vsb . getMaximum ( ) - vsb . getVisibleAmount ( ) ) ) ; ScrollPaneAdjustable vadj = ( ScrollPaneAdjustable ) sp . getVAdjustable ( ) ; setAdjustableValue ( vadj , vsb . getValue ( ) , type ) ; sy = - ( vsb . getValue ( ) ) ; Graphics g = getGraphics ( ) ; if ( g != null ) { try { paintVerScrollbar ( g , colors , true ) ; } finally { g . dispose ( ) ; } } } } c . move ( sx , sy ) ; }
scroll the contents to position x , y
