void updateVisibilityModel(){
  Component c=getContainer();
  if (c instanceof JTextField) {
    JTextField field=(JTextField)c;
    BoundedRangeModel vis=field.getHorizontalVisibility();
    int hspan=(int)getPreferredSpan(X_AXIS);
    int extent=vis.getExtent();
    int maximum=Math.max(hspan,extent);
    extent=(extent == 0) ? maximum : extent;
    int value=maximum - extent;
    int oldValue=vis.getValue();
    if ((oldValue + extent) > maximum) {
      oldValue=maximum - extent;
    }
    value=Math.max(0,Math.min(value,oldValue));
    vis.setRangeProperties(value,extent,0,maximum,false);
  }
}

void updateVisibilityModel ( ) { Component c = getContainer ( ) ; if ( c instanceof JTextField ) { JTextField field = ( JTextField ) c ; BoundedRangeModel vis = field . getHorizontalVisibility ( ) ; int hspan = ( int ) getPreferredSpan ( X_AXIS ) ; int extent = vis . getExtent ( ) ; int maximum = Math . max ( hspan , extent ) ; extent = ( extent == 0 ) ? maximum : extent ; int value = maximum - extent ; int oldValue = vis . getValue ( ) ; if ( ( oldValue + extent ) > maximum ) { oldValue = maximum - extent ; } value = Math . max ( 0 , Math . min ( value , oldValue ) ) ; vis . setRangeProperties ( value , extent , 0 , maximum , false ) ; } }
update the visibility model with the associated jtextfield ( if there is one ) to reflect the current visibility as a result of changes to the document model . the bounded range properties are updated . if the view hasn ' t yet been shown the extent will be zero and we just set it to be full until determined otherwise .
