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

[EditableComboBox] on action event is called twice on commit

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: fx2.1
    • Fix Version/s: fx2.1
    • Component/s: javafx
    • Environment:

      2.1.0b14.

      Description

      You may run attached code:

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      /**
       * @author Alexander Kirov
       */
      public class Issue4 extends Application {

          public static void main(String[] args) {
              launch(args);
          }
          final ComboBox<String> testedComboBox = new ComboBox<String>();
          static int counter = 0;

          @Override
          public void start(Stage stage) throws Exception {
              VBox pane = new VBox();
              pane.setPrefHeight(200);
              pane.setPrefWidth(200);
              testedComboBox.setEditable(true);

              testedComboBox.getItems().addAll("1", "2", "3");

              VBox vb = new VBox();

              pane.getChildren().addAll(testedComboBox);
              
              testedComboBox.setOnAction(new EventHandler<ActionEvent>(){

                  public void handle(ActionEvent t) {
                      System.out.println("Is called");
                  }
              });
              
              vb.getChildren().addAll(pane);
              Scene scene = new Scene(vb, 400, 400);
              stage.setScene(scene);
              stage.show();
          }
      }

      Steps to reproduce:
      type "a";
      press Enter;

      I see in output:
      run:
      Is called
      Is called

      But I expect only one call.

      You may see issue on attached image.

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              akirov Alexander Kirov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: