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

JComboBox spec is missing exception info for setSelectedIndex() method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.0
    • 1.2.0
    • docs
    • kestrel
    • generic, x86
    • generic, windows_nt
    • Verified


      The JComboBox.setSelectedIndex() method throws an
      IllegalArgumentException if the specified index is out
      of bounds.

      The JComboBox spec does not specify this.

      from : ###@###.###
      When the ComboBoxModel of a JComboBox is set to null or a array of
      length 0 the propertyChange that is called
      in the chain of events tries to call ComboBoxModel.setSelectedIndex(0)
      which results in a IllegalArgumentException.
      For non editable ComboBoxes this behaviour _may_ be correct but for
      editable ComboBoxes not.
      In general it is possible to create a DefaultComboBoxModel with a array
      of length 0. (It should also be possible to create it with a null value
      for a empty list). If the length is zero no selectedObject is set. That
      should also be the default behaviour of the propertyChange method.

      Exception occurred during event dispatching:

            sharonz Sharon Zakhour (Inactive)
            gaurisha Gauri Sharma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: