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

[ComboBox] ComboBox Popup not maintaining its position wrt control when mouse scrolled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u20
    • 7u45
    • javafx
    • Windows 7, JDK 7 update 45

      The comboBox popup is not maintaining its position with respect to the comboBox control, when the user does a scroll with mouse.

      Do the below steps after running the application:
      1) Click on combobox to show the options popup.
      2) Move the mouse outside (over scrollpane) and do the mouse scroll.
      3) The combobox is moved where as the popup stays. This gets confused if I have more comboboxes in the form.

      import java.util.Arrays;
      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.geometry.Insets;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.control.ScrollPaneBuilder;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.StackPaneBuilder;
      import javafx.scene.paint.Color;
      import javafx.stage.Stage;

      public class ComboBoxPopupIssue extends Application {
      public static void main(String[] args) {
      Application.launch(args);
      }

      @Override
      public void start(Stage stage) throws Exception {
      ComboBox<String> comboBox = new ComboBox<>();
      comboBox.setItems(FXCollections.observableArrayList(Arrays.asList("One", "Two", "Three")));
      StackPane root = new StackPane();
      root.getChildren().add(
      ScrollPaneBuilder
      .create()
      .fitToHeight(true)
      .fitToWidth(true)
      .content(
      StackPaneBuilder.create().minHeight(600).padding(new Insets(50, 20, 20, 20)).alignment(Pos.TOP_LEFT)
      .children(comboBox).build()).build());

      Scene scene = new Scene(root, Color.LINEN);
      stage.setTitle(this.getClass().getSimpleName());
      stage.setWidth(500);
      stage.setHeight(500);
      stage.setScene(scene);
      stage.show();
      }
      }

            msladecek Martin Sládeček
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: