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

ChoiceBox: if the second item is selected by default, "IndexOutOfBoundsException" is reported.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • javafx
    • Win7, jdk1.6.0_33, JavaFX8.0 b56.

      Create a ChoiceBox and select the second item by default, when runing the program and trying to select other items, "IndexOutOfBoundsException" is reported. Other default selections work fine.

      For example:
              ChoiceBox cb = new ChoiceBox();
              cb.getItems().addAll("Dog", "Horse", "Cat", "Monkey", "Rabbit");
              cb.getSelectionModel().select("Horse");

      Runtime Exception:
      java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
      at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      at java.util.ArrayList.get(ArrayList.java:322)
      at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:229)
      at com.sun.javafx.scene.control.skin.ContextMenuContent.getMenuYOffset(ContextMenuContent.java:745)
      at com.sun.javafx.scene.control.skin.ChoiceBoxSkin.handleControlPropertyChanged(ChoiceBoxSkin.java:235)
      at javafx.scene.control.SkinBase$3.call(SkinBase.java:244)
      at javafx.scene.control.SkinBase$3.call(SkinBase.java:242)
      at com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler$1.changed(MultiplePropertyChangeListenerHandler.java:55)
      at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:86)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:175)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:79)
      at javafx.beans.property.ReadOnlyBooleanWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:176)
      at javafx.beans.property.ReadOnlyBooleanWrapper$ReadOnlyPropertyImpl.access$100(ReadOnlyBooleanWrapper.java:146)
      at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:142)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:107)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:140)
      at javafx.scene.control.ChoiceBox.show(ChoiceBox.java:303)
      at com.sun.javafx.scene.control.behavior.ChoiceBoxBehavior.mouseReleased(ChoiceBoxBehavior.java:124)
      at javafx.scene.control.SkinBase$2.handle(SkinBase.java:122)
      at javafx.scene.control.SkinBase$2.handle(SkinBase.java:115)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:113)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:113)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:201)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3371)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3211)
      at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3163)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1569)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2312)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:290)
      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$3$1.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:662)

            psomashe Parvathi Somashekar (Inactive)
            jennyh Jenny Huang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: