Coderifous
Programmer
In my system I have a JList that displays values LIKE:
And my users like to use the type-ahead type functionality provided by the basic look and feel package. So if the user wants to select the "232" value, the user merely begins typing "2" (and the 213 is highlighted), and then a "3" (and the 232 is highlighted), and at that point they can hit enter, or tab off, or whatever they wish to do.
The problem comes in when the user wants to select the 11101 value, and the user types "111" in quick succession and they are promptly plopped onto the "113" value. This is correct and consistent behavior for the standard look and feel. It's even commented as such in the Swing library:
The relevant code looks like this:
So, what I'd like to do, for my one special JList, is have a different handling of the keyTyped event.
I'm a relatively unfamiliar with the Look'n'Feel libraries - in terms of if there is an easy way to replace a portion of the default behavior with my own custom behavior, via subclassing, dynamic redefinition, or whatever.
Thanks for any advice in advance.
--jim
"I know how I'd do it in Ruby
Code:
Foo
Bar
Baz
1023
10432x
11101
11200
113
114
117
213
232
The problem comes in when the user wants to select the 11101 value, and the user types "111" in quick succession and they are promptly plopped onto the "113" value. This is correct and consistent behavior for the standard look and feel. It's even commented as such in the Swing library:
Code:
javax.swing.plaf.basic.BasicListUI$Handler.keyTyped(KeyEvent)
The relevant code looks like this:
Code:
if((prefix.length() == 1) && (c == prefix.charAt(0))) {
// Subsequent same key presses move the keyboard focus to the next
// object that starts with the same letter.
startIndex++;
}
So, what I'd like to do, for my one special JList, is have a different handling of the keyTyped event.
I'm a relatively unfamiliar with the Look'n'Feel libraries - in terms of if there is an easy way to replace a portion of the default behavior with my own custom behavior, via subclassing, dynamic redefinition, or whatever.
Thanks for any advice in advance.
--jim
"I know how I'd do it in Ruby