643 * Support classes * 644 * * 645 **************************************************************************/ 646 647 private static class EndButton extends Region { 648 private Region arrow; 649 650 private EndButton(String styleClass, String arrowStyleClass) { 651 getStyleClass().setAll(styleClass); 652 arrow = new Region(); 653 arrow.getStyleClass().setAll(arrowStyleClass); 654 getChildren().setAll(arrow); 655 requestLayout(); 656 } 657 658 @Override protected void layoutChildren() { 659 final double top = snappedTopInset(); 660 final double left = snappedLeftInset(); 661 final double bottom = snappedBottomInset(); 662 final double right = snappedRightInset(); 663 final double aw = snapSize(arrow.prefWidth(-1)); 664 final double ah = snapSize(arrow.prefHeight(-1)); 665 final double yPos = snapPosition((getHeight() - (top + bottom + ah)) / 2.0); 666 final double xPos = snapPosition((getWidth() - (left + right + aw)) / 2.0); 667 arrow.resizeRelocate(xPos + left, yPos + top, aw, ah); 668 } 669 670 @Override protected double computeMinHeight(double width) { 671 return prefHeight(-1); 672 } 673 674 @Override protected double computeMinWidth(double height) { 675 return prefWidth(-1); 676 } 677 678 @Override protected double computePrefWidth(double height) { 679 final double left = snappedLeftInset(); 680 final double right = snappedRightInset(); 681 final double aw = snapSize(arrow.prefWidth(-1)); 682 return left + aw + right; 683 } 684 685 @Override protected double computePrefHeight(double width) { 686 final double top = snappedTopInset(); 687 final double bottom = snappedBottomInset(); 688 final double ah = snapSize(arrow.prefHeight(-1)); 689 return top + ah + bottom; 690 } 691 } 692 } | 643 * Support classes * 644 * * 645 **************************************************************************/ 646 647 private static class EndButton extends Region { 648 private Region arrow; 649 650 private EndButton(String styleClass, String arrowStyleClass) { 651 getStyleClass().setAll(styleClass); 652 arrow = new Region(); 653 arrow.getStyleClass().setAll(arrowStyleClass); 654 getChildren().setAll(arrow); 655 requestLayout(); 656 } 657 658 @Override protected void layoutChildren() { 659 final double top = snappedTopInset(); 660 final double left = snappedLeftInset(); 661 final double bottom = snappedBottomInset(); 662 final double right = snappedRightInset(); 663 final double aw = snapSizeX(arrow.prefWidth(-1)); 664 final double ah = snapSizeY(arrow.prefHeight(-1)); 665 final double yPos = snapPositionY((getHeight() - (top + bottom + ah)) / 2.0); 666 final double xPos = snapPositionX((getWidth() - (left + right + aw)) / 2.0); 667 arrow.resizeRelocate(xPos + left, yPos + top, aw, ah); 668 } 669 670 @Override protected double computeMinHeight(double width) { 671 return prefHeight(-1); 672 } 673 674 @Override protected double computeMinWidth(double height) { 675 return prefWidth(-1); 676 } 677 678 @Override protected double computePrefWidth(double height) { 679 final double left = snappedLeftInset(); 680 final double right = snappedRightInset(); 681 final double aw = snapSizeX(arrow.prefWidth(-1)); 682 return left + aw + right; 683 } 684 685 @Override protected double computePrefHeight(double width) { 686 final double top = snappedTopInset(); 687 final double bottom = snappedBottomInset(); 688 final double ah = snapSizeY(arrow.prefHeight(-1)); 689 return top + ah + bottom; 690 } 691 } 692 } |