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

ComboBox loses its content when focus is lost

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 7u6
    • 7u6
    • javafx
    • Windows XP, JavaFX 2.2b13, JRE 7.4

      I've a simple Stage, with a TextField and a ComboBox (see below). If I run them separatedly everything works fine. But if I launch the stage after launching my application (a javafx Stage and a helper Swing JFrame) the ComboBox will lose its selected value when a put the focus anywhere else (for example in the TextField). The stackTrace of the selection and the focus lost are these (I think that the setTextFromTextFieldIntoComboBoxValue could be a clue..)

      REAL SELECTION

      java.lang.Exception: Changed value:'Combo content:3'
              at etr01.avm.fxBrowser.controlPanel.FXControlPanel$3.changed(FXControlPanel.java:153)
              at etr01.avm.fxBrowser.controlPanel.FXControlPanel$3.changed(FXControlPanel.java:148)
              at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(Un
      known Source)
              at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
              at javafx.scene.control.SelectionModel.setSelectedItem(Unknown Source)
              at javafx.scene.control.ComboBox$ComboBoxSelectionModel$1.invalidated(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(Unknown
      Source)
              at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ReadOnlyIntegerWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(U
      nknown Source)
              at javafx.beans.property.ReadOnlyIntegerWrapper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.IntegerPropertyBase.markInvalid(Unknown Source)
              at javafx.beans.property.IntegerPropertyBase.set(Unknown Source)
              at javafx.scene.control.SelectionModel.setSelectedIndex(Unknown Source)
              at javafx.scene.control.SingleSelectionModel.updateSelectedIndex(Unknown Source)
              at javafx.scene.control.SingleSelectionModel.select(Unknown Source)
              at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$8.invalidated(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ReadOnlyIntegerWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(U
      nknown Source)
              at javafx.beans.property.ReadOnlyIntegerWrapper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.IntegerPropertyBase.markInvalid(Unknown Source)
              at javafx.beans.property.IntegerPropertyBase.set(Unknown Source)
              at javafx.scene.control.SelectionModel.setSelectedIndex(Unknown Source)
              at javafx.scene.control.MultipleSelectionModelBase.select(Unknown Source)
              at javafx.scene.control.MultipleSelectionModelBase.clearAndSelect(Unknown Source)
              at com.sun.javafx.scene.control.behavior.ListCellBehavior.simpleSelect(Unknown Source)
              at com.sun.javafx.scene.control.behavior.ListCellBehavior.doSelect(Unknown Source)
              at com.sun.javafx.scene.control.behavior.ListCellBehavior.mousePressed(Unknown Source)
              at com.sun.javafx.scene.control.skin.SkinBase$4.handle(Unknown Source)
              at com.sun.javafx.scene.control.skin.SkinBase$4.handle(Unknown Source)
              at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
              at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
              at javafx.event.Event.fireEvent(Unknown Source)
              at javafx.scene.Scene$MouseHandler.process(Unknown Source)
              at javafx.scene.Scene$MouseHandler.process(Unknown Source)
              at javafx.scene.Scene$MouseHandler.access$1900(Unknown Source)
              at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
              at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
              at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
              at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
              at com.sun.glass.ui.View.notifyMouse(Unknown Source)
              at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
              at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
              at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)


      FOCUS LOST



      java.lang.Exception: Changed value:''
      12:13:08 20/06/12 [GEN] SEVERE Uncaught exception not generated, too many exceptions
              at etr01.avm.fxBrowser.controlPanel.FXControlPanel$3.changed(FXControlPanel.java:153)
              at etr01.avm.fxBrowser.controlPanel.FXControlPanel$3.changed(FXControlPanel.java:148)
              at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(Un
      known Source)
              at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
              at javafx.scene.control.SelectionModel.setSelectedItem(Unknown Source)
              at javafx.scene.control.ComboBox$2.changed(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
              at javafx.scene.control.ComboBoxBase.setValue(Unknown Source)
              at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.setTextFromTextFieldIntoComboBoxVa
      lue(Unknown Source)
              at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.access$200(Unknown Source)
              at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$5.changed(Unknown Source)
              at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$5.changed(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(Unknown Source
      )
              at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(Unknown Source)
              at javafx.scene.Node$FocusedProperty.notifyListeners(Unknown Source)
              at javafx.scene.Node.setFocused(Unknown Source)
              at com.sun.javafx.scene.control.FocusableTextField.setFakeFocus(Unknown Source)
              at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$2.changed(Unknown Source)
              at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$2.changed(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
              at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
              at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(Unknown Source)
              at javafx.scene.Node$FocusedProperty.notifyListeners(Unknown Source)
              at javafx.scene.Scene$14.invalidated(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
              at javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
              at javafx.scene.Scene$KeyHandler.setFocusOwner(Unknown Source)
              at javafx.scene.Scene$KeyHandler.requestFocus(Unknown Source)
              at javafx.scene.Scene$KeyHandler.access$2400(Unknown Source)
              at javafx.scene.Scene.requestFocus(Unknown Source)
              at javafx.scene.Node.requestFocus(Unknown Source)
              at com.sun.javafx.scene.control.behavior.TextFieldBehavior.mousePressed(Unknown Source)
              at com.sun.javafx.scene.control.skin.SkinBase$4.handle(Unknown Source)
              at com.sun.javafx.scene.control.skin.SkinBase$4.handle(Unknown Source)
              at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
              at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
              at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
              at javafx.event.Event.fireEvent(Unknown Source)
              at javafx.scene.Scene$MouseHandler.process(Unknown Source)
              at javafx.scene.Scene$MouseHandler.process(Unknown Source)
              at javafx.scene.Scene$MouseHandler.access$1900(Unknown Source)
              at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
              at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
              at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
              at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
              at com.sun.glass.ui.View.notifyMouse(Unknown Source)
              at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
              at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
              at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)



      Stage stage = new Stage();
      // workaround for RT-10714
      stage.setWidth(640);
      stage.setHeight(800);
      stage.setTitle("Scenic View");
      final VBox g = new VBox();
      g.getChildren().add(new TextField());
      final ObservableList<String> citems = FXCollections
      .observableArrayList();
      for (int i = 0; i < 10; i++) {
      citems.add("Combo content:" + i);
      }
      final ComboBox<String> comboTest = new ComboBox<String>();
      comboTest.setItems(citems);
      comboTest.setPrefWidth(250);
      comboTest.getSelectionModel().selectedItemProperty()
      .addListener(new ChangeListener<String>() {

      @Override
      public void changed(
      final ObservableValue<? extends String> arg0,
      final String arg1, final String newValue) {
      new Exception("Changed value:'" + newValue + "'").printStackTrace();
      }
      });
      g.getChildren().add(comboTest);
      stage.setScene(new Scene(g));
      stage.show();

            jgiles Jonathan Giles
            anruizjfx Ander Ruiz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: