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

First letter navigation does not work for items with double letter prefix

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs
    • Fix Understood
    • x86
    • windows_2000



      Name: rmT116609 Date: 04/15/2004


      A DESCRIPTION OF THE REQUEST :
      In a JList with a large number of items, first letter navigation can be used to select an item by typing the displayed text of the item. However, this method cannot be used to find an item that starts with the same letter twice.

      For example, consider this list of British towns and cities:

      Cardiff
      Leamington
      Leeds
      Liverpool
      Llanelli
      London
      Swansea

      If this is displayed in a JList, any of the items can be selected by typing its name, except Llanelli. If 'L' is typed twice the selection moves through the places starting with L. Even if 'Lla' is typed, the selection does not change to 'Llanelli'.

      This is obviously a trivial problem with this example, but consider a list of all British towns and cities with thousands of entries, hundreds of which start with 'Ll'. It is impossible to quickly select any of these by typing their name.

      JUSTIFICATION :
      It would allow any item in a very long list to be quickly selected by typing its displayed text, regardless of what letters are in the text. This saves scrolling through to find the item.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Typing L, L, A should select 'Llanelli': the first item beginning with 'Lla'.
      ACTUAL -
      Typing L, L, A selects 'Leeds': the second item beginning with 'L'.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class FirstLetterNavigation
      {
       public static void main( String[] args )
       {
        JList list = new JList( new String[] {
         "Cardiff", "Leamington", "Leeds", "Liverpool",
         "Llanelli", "London", "Swansea" } );
        JFrame frame = new JFrame();
        frame.getContentPane().add( list );
        frame.pack();
        frame.show();
       }
      }
      ---------- END SOURCE ----------
      (Incident Review ID: 231990)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: