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

[ListView] Multiple selection works inconsistently.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 8u60
    • 8
    • javafx
    • jdk1.8.0_b66 Mac OS X 10.7.4

      To reproduce:
      1. Click on the first label;
      2. Push Meta+A;
      3. Push Meta+Down arrow;
      4. Push Shift+Down arrow;
      It is expected that nothing will change and that all items will remain selected, but actually only the last item will be selected.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.ListView;
      import javafx.scene.control.SelectionMode;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class JavaFXApplication16 extends Application {
          
          @Override
          public void start(Stage primaryStage) {
              ListView lv = new ListView();
              for (int i = 0; i < 10; i++) {
                  lv.getItems().add(new Label("Label-" + i));
              }
              lv.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
              
              StackPane root = new StackPane();
              root.getChildren().add(lv);
              
              Scene scene = new Scene(root, 300, 250);
              
              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

            jgiles Jonathan Giles
            dzinkevi Dmitry Zinkevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: