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

AccessibleJComboBox methods return different objects like combobox child

XMLWordPrintable

    • kestrel
    • sparc
    • solaris_2.6
    • Not verified



      Name: aaC67449 Date: 09/22/99


      AccessibleJComboBox methods getAccessibleSelection(int) and
      getAccessibleChild(int) returns different type of objects like combobox child.

      getAccessibleSelection(int) returns the
      JList.AccessibleJList.AccessibleJListChild object, that represent
      an item of combobox,
      but getAccessibleChild(int) return the MetalComboBoxUI.MetalComboPopup, that
      represent a popupmenu of combobox.
      It should be documented whether a popupmenu or an item (I think an item) should be returned
       and the methods should be reimplemented according to the documentation.

      See example:
      ------------------------- example ----------------
      import javax.swing.JComboBox;
      import javax.accessibility.*;

      public class Test{

         public static void main(String argv[]) {
            JComboBox c = new JComboBox();
            AccessibleContext ac = c.getAccessibleContext();
            AccessibleSelection as = ac.getAccessibleSelection();
            c.addItem("Test");
            c.setSelectedIndex(0);
            System.out.println("AccessibleCild(0) = " + ac.getAccessibleChild(0));
            System.out.println("AccessibleSelection(0) = "
                    + as.getAccessibleSelection(0));
         }

      }

      -------------------- output -------------------
      AccessibleCild(0) = javax.swing.plaf.metal.MetalComboBoxUI$MetalComboPopup[,0,0,0x0,invalid,layout=javax.swing.BoxLayout,alignmentX=null,alignmentY=null,border=javax.swing.border.LineBorder@4bfe9d,flags=3,maximumSize=,minimumSize=,preferredSize=,desiredLocationX=0,desiredLocationY=0,label=,lastPopupType=,lightWeightPopupEnabled=true,margin=,paintBorder=true]
      AccessibleSelection(0) = javax.swing.JList$AccessibleJList$AccessibleJListChild@189f84

      ------------------ javadoc -------------

      public Accessible getAccessibleChild(int i)

            Returns the nth Accessible child of the object.



      public Accessible getAccessibleSelection(int i)

            Returns an Accessible representing the specified selected child in the object. If there
            isn't a selection, or there are fewer children selected than the integer passed in, the
            return value will be null.

      ----------------------------------------
      ======================================================================

            lmonsantsunw Lynn Monsanto (Inactive)
            alisunw Ali Ali (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: