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

DefaultComboBoxModel: inconsistency between addElement/insertElementAt

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      Name: dbT83986 Date: 12/23/98


      DefaultComboBoxModel: inconsistency between addElement/insertElementAt
      (swing1.1beta/2)



      we can add the first element to the list by two methods

      1. addElement(object) - adds the element and then select it
      2. insertElementAt(object, 0) - only adds the element without selecting

      Fix:

      in addElement delegate to insertElementAt with

         void addElement(Object object) {
      insertElementAt(object, objects.getSize());
         }

      Greetings
      Jeanette

      PS:
      My personal opinion is that there should be no default selection at all.
      "Nothing selected" is a totally natural state on initialisation,
      explicitly changing it should be under the control of clients
      (Review ID: 37497)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: