Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8127657

ComboBox list popup should match size of button, if button has been resized

    XMLWordPrintable

Details

    Description

      Justification for adding this is that it allows the ListView in the popup to be the full width of the button, rather than just its preferred width (which would look ugly if the button was made to be wider, for example, in ListView cell editing. Refer to the screenshots for before and after shots.

      Patch:

      # HG changeset patch
      # User jgiles
      # Date 1330476478 -46800
      # Node ID b39b67408949a256b026da586c54568268eec1eb
      # Parent c3fad1bef744a8f07356623607729ddbf4df8521
      RT-19979: ComboBox list popup should match size of button, if button has been resized

      diff --git a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java
      --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java
      +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java
      @@ -316,7 +316,7 @@
                               rowsToMeasure = (Integer) comboBox.getProperties().get(COMBO_BOX_ROWS_TO_MEASURE_WIDTH_KEY);
                           }
                           
      - pw = skin.getMaxCellWidth(rowsToMeasure) + 30;
      + pw = Math.max(comboBox.getWidth(), skin.getMaxCellWidth(rowsToMeasure) + 30);
                       } else {
                           pw = Math.max(100, comboBox.getWidth());
                       }

      Attachments

        1. before.jpg
          before.jpg
          90 kB
        2. after.jpg
          after.jpg
          90 kB

        Activity

          People

            jgiles Jonathan Giles
            jgiles Jonathan Giles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: