377 378 379 /*************************************************************************** 380 * * 381 * Public API * 382 * * 383 **************************************************************************/ 384 385 /** {@inheritDoc} */ 386 @Override public void dispose() { 387 super.dispose(); 388 389 if (behavior != null) { 390 behavior.dispose(); 391 } 392 } 393 394 /** 395 * Returns the horizontal {@link ScrollBar} used in this ScrollPaneSkin 396 * instance. 397 */ 398 public final ScrollBar getHorizontalScrollBar() { 399 return hsb; 400 } 401 402 /** 403 * Returns the vertical {@link ScrollBar} used in this ScrollPaneSkin 404 * instance. 405 */ 406 public final ScrollBar getVerticalScrollBar() { 407 return vsb; 408 } 409 410 /** {@inheritDoc} */ 411 @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { 412 final ScrollPane sp = getSkinnable(); 413 414 double vsbWidth = computeVsbSizeHint(sp); 415 double minWidth = vsbWidth + snappedLeftInset() + snappedRightInset(); 416 417 if (sp.getPrefViewportWidth() > 0) { 418 return (sp.getPrefViewportWidth() + minWidth); 419 } 420 else if (sp.getContent() != null) { 421 return (sp.getContent().prefWidth(height) + minWidth); 422 } 423 else { 424 return Math.max(minWidth, DEFAULT_PREF_SIZE); | 377 378 379 /*************************************************************************** 380 * * 381 * Public API * 382 * * 383 **************************************************************************/ 384 385 /** {@inheritDoc} */ 386 @Override public void dispose() { 387 super.dispose(); 388 389 if (behavior != null) { 390 behavior.dispose(); 391 } 392 } 393 394 /** 395 * Returns the horizontal {@link ScrollBar} used in this ScrollPaneSkin 396 * instance. 397 * @return the horizontal ScrollBar used in this ScrollPaneSkin instance 398 */ 399 public final ScrollBar getHorizontalScrollBar() { 400 return hsb; 401 } 402 403 /** 404 * Returns the vertical {@link ScrollBar} used in this ScrollPaneSkin 405 * instance. 406 * @return the vertical ScrollBar used in this ScrollPaneSkin instance 407 */ 408 public final ScrollBar getVerticalScrollBar() { 409 return vsb; 410 } 411 412 /** {@inheritDoc} */ 413 @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { 414 final ScrollPane sp = getSkinnable(); 415 416 double vsbWidth = computeVsbSizeHint(sp); 417 double minWidth = vsbWidth + snappedLeftInset() + snappedRightInset(); 418 419 if (sp.getPrefViewportWidth() > 0) { 420 return (sp.getPrefViewportWidth() + minWidth); 421 } 422 else if (sp.getContent() != null) { 423 return (sp.getContent().prefWidth(height) + minWidth); 424 } 425 else { 426 return Math.max(minWidth, DEFAULT_PREF_SIZE); |