@@ -74,6 +74,9 @@ private void createReferenceComponentCB(SectionTitledPane<T> control) {
7474 protected void layoutChildren (double x , double y , double width , double height ) {
7575 super .layoutChildren (x , y , width , height );
7676
77+ final double titleRegionX = titleRegion .getLayoutX ();
78+ final double titleRegionWidth = titleRegion .getWidth ();
79+ final double titleRegionRightInset = titleRegion .snappedRightInset ();
7780 final double titleRegionHeight = titleRegion .getHeight ();
7881
7982 final double titleRegionTextX = titleRegionText .getLayoutX ();
@@ -87,9 +90,14 @@ protected void layoutChildren(double x, double y, double width, double height) {
8790 editButton .setLayoutY (titleRegion .getLayoutY ());
8891
8992 // Reference Component Semantics Combobox
93+ double cbPrefWidth = referenceComponentSemanticsCB .prefWidth (-1 );
94+ double cbMaxWidth = editButtonX - SPACE_BETWEEN_SEMANTIC_CB_AND_EDIT_BUTTON
95+ - (titleRegionTextX + titleRegionTextWidth + SPACE_BETWEEN_TITLE_AND_SEMANTIC_CB );
96+ double cbWidth = Math .min (cbPrefWidth , cbMaxWidth );
97+
98+ double cbX = titleRegionX + titleRegionWidth - titleRegionRightInset
99+ - editButtonWidth - cbWidth - SPACE_BETWEEN_SEMANTIC_CB_AND_EDIT_BUTTON ;
90100
91- double cbX = titleRegionTextX + titleRegionTextWidth + SPACE_BETWEEN_TITLE_AND_SEMANTIC_CB ;
92- double cbWidth = editButtonX - cbX - SPACE_BETWEEN_SEMANTIC_CB_AND_EDIT_BUTTON ;
93101 double cbHeight = referenceComponentSemanticsCB .prefHeight (cbWidth );
94102 double cbY = titleRegionHeight / 2d - cbHeight / 2d ;
95103 referenceComponentSemanticsCB .resize (cbWidth , cbHeight );
0 commit comments