src/java.desktop/share/classes/java/awt/ScrollPane.java

Print this page




 483         if (childSize.height < viewHeight) {
 484             childSize.height = viewHeight;
 485         }
 486 
 487         return childSize;
 488     }
 489 
 490     /**
 491      * @deprecated As of JDK version 1.1,
 492      * replaced by <code>doLayout()</code>.
 493      */
 494     @Deprecated
 495     public void layout() {
 496         if (getComponentCount()==0) {
 497             return;
 498         }
 499         Component c = getComponent(0);
 500         Point p = getScrollPosition();
 501         Dimension cs = calculateChildSize();
 502         Dimension vs = getViewportSize();
 503         Insets i = getInsets();
 504 
 505         c.reshape(i.left - p.x, i.top - p.y, cs.width, cs.height);
 506         ScrollPanePeer peer = (ScrollPanePeer)this.peer;
 507         if (peer != null) {
 508             peer.childResized(cs.width, cs.height);
 509         }
 510 
 511         // update adjustables... the viewport size may have changed
 512         // with the scrollbars coming or going so the viewport size
 513         // is updated before the adjustables.
 514         vs = getViewportSize();
 515         hAdjustable.setSpan(0, cs.width, vs.width);
 516         vAdjustable.setSpan(0, cs.height, vs.height);
 517     }
 518 
 519     /**
 520      * Prints the component in this scroll pane.
 521      * @param g the specified Graphics window
 522      * @see Component#print
 523      * @see Component#printAll
 524      */
 525     public void printComponents(Graphics g) {




 483         if (childSize.height < viewHeight) {
 484             childSize.height = viewHeight;
 485         }
 486 
 487         return childSize;
 488     }
 489 
 490     /**
 491      * @deprecated As of JDK version 1.1,
 492      * replaced by <code>doLayout()</code>.
 493      */
 494     @Deprecated
 495     public void layout() {
 496         if (getComponentCount()==0) {
 497             return;
 498         }
 499         Component c = getComponent(0);
 500         Point p = getScrollPosition();
 501         Dimension cs = calculateChildSize();
 502         Dimension vs = getViewportSize();

 503 
 504         c.reshape(- p.x, - p.y, cs.width, cs.height);
 505         ScrollPanePeer peer = (ScrollPanePeer)this.peer;
 506         if (peer != null) {
 507             peer.childResized(cs.width, cs.height);
 508         }
 509 
 510         // update adjustables... the viewport size may have changed
 511         // with the scrollbars coming or going so the viewport size
 512         // is updated before the adjustables.
 513         vs = getViewportSize();
 514         hAdjustable.setSpan(0, cs.width, vs.width);
 515         vAdjustable.setSpan(0, cs.height, vs.height);
 516     }
 517 
 518     /**
 519      * Prints the component in this scroll pane.
 520      * @param g the specified Graphics window
 521      * @see Component#print
 522      * @see Component#printAll
 523      */
 524     public void printComponents(Graphics g) {